Hello Márcio,

Thursday, July 29, 2004, 6:46:55 PM, you wrote:

MO> hi!

MO> I need to organize a list of values i a hash, but i don't know how.

MO> ex:

MO> my %urls;

MO> $urls{uol} = 1;
MO> $urls{aol} = 2;
MO> $urls{txt} = 3;

MO> ## if i use this:

MO> @num = sort keys(%url};

MO> foreach $number(@num) {
MO>    print $number."\n";
MO> }

MO> ## I have this output:

MO> aol
MO> txt
MO> uol

MO> ## how i can organize the values and print the values hash "key", with this
MO> output (sorted by hash values):

MO> 1 uol
MO> 2 aol
MO> 3 txt

my %urls;

$urls{uol} = 1;
$urls{aol} = 2;
$urls{txt} = 3;

my %rev = reverse %urls;
foreach(sort keys %rev){
        print $_." ".$rev{$_}."\n";
}

-- 
Best regards,
 Pavel                            mailto:[EMAIL PROTECTED]


_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to