Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: sorting files

by graff (Chancellor)
on May 30, 2008 at 02:22 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2024-04-16 10:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found