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

Re: sorting files

by graff (Chancellor)
on May 30, 2008 at 02:22 UTC ( #689130=note: print w/replies, xml ) Need Help??


in reply to sorting files

I'm surprised that I seem to be the first one to suggest a Schwartzian Transform:
@TXT = map { s/\d+ //; $_ } sort map { s/(.*?)_(\d+)_/sprintf("%04d %s_%s_",$2,$1,$2)/e; $_ } gl +ob( "*.txt" );
(Not fully tested, but updated to add a missing "_" in the replacement string of the s///e operation)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2022-12-06 07:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?