Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Sort - can't

by tlm (Prior)
on Aug 29, 2005 at 01:33 UTC ( #487319=note: print w/replies, xml ) Need Help??


in reply to Re: Sort - can't
in thread Sort - can't

Sort what by what?

Your code is too way off for me to decipher your intentions.

If you want to sort the filenames by the substring after the last _, then I'd do something like

my @sorted = map $_->[ 0 ], sort { $a->[ 1 ] cmp $b->[ 1 ] } map [ $_, ( split '_' )[ -1 ] ], @unsorted;
(untested).

the lowliest monk

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2020-12-01 21:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (21 votes). Check out past polls.

    Notices?