http://qs1969.pair.com?node_id=689130


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)