Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: sorting files

by poolpi (Hermit)
on May 30, 2008 at 13:06 UTC ( #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? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2022-12-01 00:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?