They are the default variables used by sort for their processing.  That is why you want to be careful if you are using the variables $a and $b and playing with sort besides.
 
Wags ;)  ps to get a descending sort then switch where a and b are used and it now becomes a descending sort verses an ascending sort.
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Márcio Oliveira
Sent: Thursday, July 29, 2004 12:04
To: [EMAIL PROTECTED]
Subject: RE: [Perl-unix-users] sorting hash values

this solution perfectly work to me:

foreach ( sort { $urls{$a} <=> $urls{$b} } keys %urls ) {
   print LOG "$urls{$_} $_\n";
}
 
thank' to all;
 
but I'm a beginner in perl programing world and i'd like to know how the $a and $b vars work in this case.
 
thank's again!
 
Márcio Oliveira
LPIC-1


*******************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
*******************************************************
_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to