Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Efficiently sorting array by non-alpha strings

by borisz (Canon)
on Feb 20, 2004 at 16:05 UTC ( [id://330574]=note: print w/replies, xml ) Need Help??


in reply to Efficiently sorting array by non-alpha strings

Use a hash to remap your field.
my %h = ( National => 3, State => 2, Local => 1 ); my @sorted_advocates = sort { $h{$a->{fld_type}} <=> $h{$b->{fld_type} +} } @advocates;
Boris

Log In?
Username:
Password:

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

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

    No recent polls found