One thing at a time all the time!

Welcome to Rocteur
Saturday, April 20 2024 @ 06:41 AM CEST

How can I have it read a directory with the oldest file first

How can I have it read a directory with the oldest file first

my $dir = '//home/user/';

opendir DH, $dir or die "Can not open $dir: $!";

my @files = map $_->[0],
sort { $b->[1] <=> $a->[1] }
map [ $_, -M "$dir/$_" ],
grep /^Sj/,
readdir DH;

closedir DH;

FAQ Manager » Perl » How can I have it read a directory with the oldest file first