in reply to sort by date

If you
use File::stat; # don't worry, it's part of standard perl
then you can
@allPictures = sort {stat($a)->mtime <=> stat($b)->mtime} @allPictures;
That should do it.

Replies are listed 'Best First'.
Re: Re: sort by date
by Roger (Parson) on Nov 30, 2003 at 23:11 UTC
    I would rather do an orcish manueuver instead. ;-)

    use File::stat; ... my %m; @allPictures = sort { ($m{$a} ||= stat($a)->mtime) <=> ($m{$b} ||= stat($b)->mtime) } @allPictures;
    or simpler version -
    my %m; @allPictures = sort { ($m{$a} ||= -M $a) <=> ($m{$b} ||= -M $b) } @allPictures;