in reply to How do I sort by certain parts of a filename?
You could also apply the so called Schwartian Transform if your Dates are not directly compariable and need a special function:# this searches on Date1 my @sorted_list = sort { ${split(/_/,$a)}[0] cmp ${split(/_/,$b)}[0] } @list; # [0] is Date1, [1] is Date2, [2] is type.asp
my @sorted_list = map { $_[0] } sort { date_compare($a[1],$b[1]) } # [1] is Date1, [2] is Date2, [3] is the type.asp map { [ $_, split /_/ ] } @list;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do I sort by certain parts of a filename?
by cLive ;-) (Prior) on May 10, 2001 at 03:36 UTC | |
|
Re: Re: How do I sort by certain parts of a filename?
by jeroenes (Priest) on May 10, 2001 at 09:46 UTC | |
by tye (Sage) on May 10, 2001 at 10:24 UTC | |
by jeroenes (Priest) on May 10, 2001 at 11:09 UTC |