Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Sorting based on a specific order

by Not_a_Number (Parson)
on Jan 02, 2011 at 17:40 UTC ( #880086=note: print w/replies, xml ) Need Help??


in reply to Sorting based on a specific order

Or even (no sorting, no array index arithmetic):

my %wanted = map { $_ => 1 } @unsorted; my @sorted = grep { $wanted{$_} } @preferred;
Update: corrected typo 'arthimetic'.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://880086]
help
Chatterbox?
and the pool shimmers...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2017-09-22 23:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (270 votes). Check out past polls.

    Notices?