in reply to Sort files descending by date
If there is a possibility of the format of the filenames changing, I'd use somthing like:
my @sorted_list = map { $_ -> [1] } sort { $a->[0] cmp $b->[0] } map { [ do { (my $x = $_) =~ tr/0-9//dc; $x }, $_ ] } @file_list;
However, having written it, I'm not particularly proud of using a do{} within a map.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Sort files descending by date
by ikegami (Patriarch) on Jun 19, 2007 at 18:08 UTC | |
by FunkyMonk (Bishop) on Jun 19, 2007 at 18:19 UTC |