Remove default data hash sorting in perl script?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Remove default data hash sorting in perl script?
# 1  
Old 10-06-2010
Remove default data hash sorting in perl script?

Hi,

I have a datahash with 'n' number of values in perl script. I am writing a xml file from the datahash. I am getting output with sorting(Field sorting). My question is that i don't want any default sorting.whatever i am inserting into datahash it should give same xml file.

Any help?

this is bleow code
Code:
my %dataHash;
%dataHash = ();
#$loginCnt is key
# $usrLoginID and $usrPriv retrieved value
$dataHash{Server}{Login}{$loginCnt}{DBLogin} = $usrLoginID;  
$dataHash{Server}{Login}{$loginCnt}{Access} = $usrPriv;


Last edited by Franklin52; 10-06-2010 at 03:23 AM.. Reason: Please use code tags!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compare values of hashes of hash for n number of hash in perl without sorting.

Hi, I have an hashes of hash, where hash is dynamic, it can be n number of hash. i need to compare data_count values of all . my %result ( $abc => { 'data_count' => '10', 'ID' => 'ABC122', } $def => { 'data_count' => '20', 'ID' => 'defASe', ... (1 Reply)
Discussion started by: asak
1 Replies

2. Shell Programming and Scripting

Sorting values of hash in ascending order using Perl

I want to sort values of a hash in ascending order. my %records; for my $value (sort values %records){print $value,"\n";} When I use the above code I get values in this order: 1,10,11,2,3,4,5,6,7,8,9. But, I need values in my output in this order: 1,2,3,4,5,6,7,8,9,10,11. Can Someone... (1 Reply)
Discussion started by: koneru_18
1 Replies

3. Shell Programming and Scripting

Perl: Sorting a hash value that is a list.

Hi Folks I am very much a newbie at perl but picking it up and I'm hoping you can help. I have a file input that details all the /etc/group files in our enterprise in the following format: "<host>:<group>:<gid>:<users>" I want to parse this data display it as the following:... (9 Replies)
Discussion started by: g_string
9 Replies

4. Programming

perl script to create hash.

Hi, I have the xml file file this, perl script to create hash<p> <university> <name>svu</name> <location>ravru</location> <branch> <electronics> <student name="xxx" number="12"> <semester number="1"subjects="7" rank="2"/> </student> <student name="xxx"... (1 Reply)
Discussion started by: veerubiji
1 Replies

5. Shell Programming and Scripting

Sorting keys of a hash in perl

hi all, i have a small problem regarding sorting the keys in a hash. my %hash; for($i=0;$i<19;$i++) { $hash{$i}=$i; } foreach $c (sort keys %hash) { print "\n $hash{$c}"; } (1 Reply)
Discussion started by: niteesh_!7
1 Replies

6. Shell Programming and Scripting

Perl Hash:Can not keep hash data in the same order that it was inserted

Can Someone explain me why even using Tie::IxHash I can not get the output data in the same order that it was inserted? See code below. #!/usr/bin/perl use warnings; use Tie::IxHash; use strict; tie (my %programs, "Tie::IxHash"); while (my $line = <DATA>) { chomp $line; my(... (1 Reply)
Discussion started by: jgfcoimbra
1 Replies

7. Shell Programming and Scripting

perl-extract data from hash values

Hello, I have parsed an xml file using perl to get the hash values and the output looks like this $VAR1 = { 'RT' => { 'List' => { 'String' => ... (1 Reply)
Discussion started by: userscript
1 Replies

8. Shell Programming and Scripting

PERL: reading 2 column data into Hash file

I am trying to read in a 2 column data file into Perl Hash array index. Here is my code. #!/usr/bin/perl -w use strict; use warnings; my $file = "file_a"; my @line = (); my $index = 0; my %ind_file = (); open(FILE, $file) or die($!); while(<FILE>) { chomp($_); if ($_ eq '') { ... (1 Reply)
Discussion started by: subhap
1 Replies

9. Shell Programming and Scripting

passing a hash to another script in perl

I have a script (say script1.sh ) and I am calling a script (say script2.sh) within the script1.sh. Here in script1.sh I have a hash ( say %hash1) and i have to pass this hash to script2.sh. Basically i have to do some processing in Scirpt2.sh based on the hash(key,values). I wanted to know how can... (2 Replies)
Discussion started by: ammu
2 Replies

10. Shell Programming and Scripting

PERL data - sorting

Hello, I have a page where multiple fields and their values are displayed. But I am able to sort only a few fields. When I looked into the issue, it is seen that the for each row of info , an unique id is generated and id.txt is generated and saved. Only those fields which are inside that id.txt... (3 Replies)
Discussion started by: eagercyber
3 Replies
Login or Register to Ask a Question
Net::LDAP::Control::Sort(3)				User Contributed Perl Documentation			       Net::LDAP::Control::Sort(3)

NAME
Net::LDAP::Control::Sort - Server Side Sort (SSS) control object SYNOPSIS
use Net::LDAP::Control::Sort; use Net::LDAP::Constant qw(LDAP_CONTROL_SORTRESULT); $sort = Net::LDAP::Control::Sort->new( order => "cn -phone" ); $mesg = $ldap->search( @args, control => [ $sort ]); ($resp) = $mesg->control( LDAP_CONTROL_SORTRESULT ); print "Results are sorted " if $resp and !$resp->result; DESCRIPTION
"Net::LDAP::Control::Sort" is a sub-class of Net::LDAP::Control. It provides a class for manipulating the LDAP Server Side Sort (SSS) request control 1.2.840.113556.1.4.473 as defined in RFC-2891 If the server supports sorting, then the response from a search operation will include a sort result control. This control is handled by Net::LDAP::Control::SortResult. CONSTRUCTOR ARGUMENTS
order A string which defines how entries may be sorted. It consists of multiple directives, spearated by whitespace. Each directive describes how to sort entries using a single attribute. If two entries have identical attributes, then the next directive in the list is used. Each directive specifies a sorting order as follows -attributeType:orderingRule The leading "-" is optional, and if present indicates that the sorting order should be reversed. "attributeType" is the attribute name to sort by. "orderingRule" is optional and indicates the rule to use for the sort and should be valid for the given "attributeType". Any one attributeType should only appear once in the sorting list. Examples "cn" sort by cn using the default ordering rule for the cn attribute "-cn" sort by cn using the reverse of the default ordering rule "age cn" sort by age first, then by cn using the default ordering rules "cn:1.2.3.4" sort by cn using the ordering rule defined as 1.2.3.4 METHODS
As with Net::LDAP::Control each constructor argument described above is also available as a method on the object which will return the current value for the attribute if called without an argument, and set a new value for the attribute if called with an argument. SEE ALSO
Net::LDAP, Net::LDAP::Control::SortResult, Net::LDAP::Control, http://www.ietf.org/rfc/rfc2891.txt AUTHOR
Graham Barr <gbarr@pobox.com> Please report any bugs, or post any suggestions, to the perl-ldap mailing list <perl-ldap@perl.org> COPYRIGHT
Copyright (c) 1999-2004 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.1 2010-03-12 Net::LDAP::Control::Sort(3)