For some stupid reason I was imagining that 

foreach(sort { $hash{$a} <=> $hash{$b} } keys %hash) {

was going to sort by the keys and not the values, overlooking the
comparison being based on the value, thanks for pointing it out (now I
understand :-)

>>> "Shawn" <[EMAIL PROTECTED]> 06/24/02 10:32am >>>
>foreach(sort { $hash{$a} <=> $hash{$b} } values %hash) {
>  print "$_\n";
>}

Err... This will not work... You will be trying to get a hash value
based on the value...

It's early....

my %hash=(thumb='122',tom=>'21',muffit=>'48',miss=>'31');
foreach(sort { $hash{$a} <=> $hash{$b} } values %hash) {
  print "$_\n";
}

this will evaluate to this in the sort:
$hash{122} <=> $hash{21} (as an example)

This will not give you any sort at all since both values are null...

Shawn





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



ITM Business Solutions
Unit 4
Nine Trees Trading Estate
Morthen Road
Rotherham
S66 9JG

Reception
Tel: 01709 703288
Fax: 01709 701549

Help Desk
Tel:01709 530424
Fax: 01709 702159

CONFIDENTIALITY NOTICE: This message is intended only for the use of
the individual or entity to which it is addressed, and may contain
information that is privileged, confidential and exempt from disclosure
under applicable law.



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

Reply via email to