oops that should have been 
@sorted_keys = sort { $hash{$a}[1] cmp $hash{$b}[1] } keys %hash;

-----Original Message-----
From: Nikola Janceski [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 06, 2002 11:48 AM
To: 'birgit kellner'; [EMAIL PROTECTED]
Subject: RE: sort on anonymous array elements as hash values


yes:

@sorted_keys = sort { $hash{$a}[2] cmp $hash{$b}[2] } keys %hash;

-----Original Message-----
From: birgit kellner [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 06, 2002 11:36 AM
To: [EMAIL PROTECTED]
Subject: sort on anonymous array elements as hash values


my %hash = (
        'keyone' => ['firstvalueone', 'firstvaluetwo],
        'secondkey' => ['anothervalueone', 'valuetwoforsecondkey'],
        'keythree' => ['thirdvalueone', 'thirdvaluetwo']
        
);

Can I sort the hash on the second element of the anonymous array?

Output should be:

firstvaluetwo
thirdvaluetwo
valuetwoforsecondkey


Many thanks in advance,


Birgit Kellner

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to