Re: [MacPerl-AnyPerl] Sorting a file list
[email protected] (John Delacour) Fri, 30 Jan 2004 10:04:50 +0000
| Newsgroups | perl.macperl.anyperl |
|---|---|
| Message-ID | <p06100c00bc3fdc5fec10@[10.0.0.1]> |
At 12:37 am +0100 30/1/04, Eelco Alosery wrote:
>how do i combine this together
Like this, but now it's time for _you_ to do some footwork :-)
my $db = "/tmp/tmp";
my ($date, $s1, $s2);
open DB, $db;
for (<DB>) {
s~^(..)-(..)-(....)(.+)~$3$2$1$4~;
push @temp, $_ ;
}
for (sort @temp) {
chomp;
s~(....)(..)(..)(.+)~$3-$2-$1$4~;
($date, $s1, $s2) = split /\|/ ;
$date and print "??? $date ??? $s1 ??? $s2 ??? $/" ;
}