You can sort the hash on the values with a snippet like this: foreach ( sort { $urls{$a} cmp $urls{$b} } keys %urls ) { print "$urls{$_} $_\n"; }
For more info, read perldoc -f sort. --Kester On Thu, 29 Jul 2004 13:46:55 -0300, Márcio Oliveira <[EMAIL PROTECTED]> wrote: > hi! > > I need to organize a list of values i a hash, but i don't know how. > > ex: > > my %urls; > > $urls{uol} = 1; > $urls{aol} = 2; > $urls{txt} = 3; > > ## if i use this: > > @num = sort keys(%url}; > > foreach $number(@num) { > print $number."\n"; > } > > ## I have this output: > > aol > txt > uol > > ## how i can organize the values and print the values hash "key", with this > output (sorted by hash values): > > 1 uol > 2 aol > 3 txt > > thank's > > Atenciosamente, > > Márcio Oliveira > LPIC-1 > > _______________________________________________ > Perl-Unix-Users mailing list > [EMAIL PROTECTED] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > _______________________________________________ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs