Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Using $a and $b for sort

by mreece (Friar)
on Jan 04, 2008 at 04:11 UTC ( [id://660372]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Using $a and $b for sort
in thread Using $a and $b for sort

if there is some strange reason you cannot lexify your other usages of $a and $b, then you can consider using a named ($$)-prototyped sort subroutine, and perl will pass the sort variables in @_ instead of package variables.
sub mysort ($$) { $_[0]->{key} <=> $_[1]->{key} } my @sorted = sort mysort @unsorted;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://660372]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-25 23:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found