Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: sorting files

by poolpi (Hermit)
on May 30, 2008 at 13:06 UTC ( [id://689209]=note: print w/replies, xml ) Need Help??


in reply to sorting files


#!/usr/bin/perl -w use strict; use Data::Dumper; use Sort::Key::Multi qw(iikeysort); chomp( my @s = <DATA> ); my @is = iikeysort { /\A .+ _ (\d+) _ (\d+) .+ txt \z/msx; } @s; print Dumper \@is; __DATA__ M3_output_ZGZ22_02_20061022_duration_200mn_comptage_60.txt M3_output_ZGZ22_078902_20061022_duration_200mn_comptage_60.txt M3_output_ZGZ22_11_20061022_duration_200mn_comptage_60.txt M3_output_ZGZ22_1_20061022_duration_200mn_comptage_60.txt M3_output_ZGZ22_078902_20051022_duration_200mn_comptage_60.txt M3_output_ZGZ22_128_20061022_duration_200mn_comptage_60.txt
Output: $VAR1 = [ 'M3_output_ZGZ22_1_20061022_duration_200mn_comptage_60.txt', 'M3_output_ZGZ22_02_20061022_duration_200mn_comptage_60.txt' +, 'M3_output_ZGZ22_11_20061022_duration_200mn_comptage_60.txt' +, 'M3_output_ZGZ22_128_20061022_duration_200mn_comptage_60.txt +', 'M3_output_ZGZ22_078902_20051022_duration_200mn_comptage_60. +txt', 'M3_output_ZGZ22_078902_20061022_duration_200mn_comptage_60. +txt' ];

hth,
PooLpi

'Ebry haffa hoe hab im tik a bush'. Jamaican proverb

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-03-28 18:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found