Use sort...
$datapath = "/Users/code/data"; my @allfiles = sort { -M $a <=> -M $b } <$datapath/*.*>; foreach $item (@allfiles) { # parsing... }
Actually, as I dislike unnecessary variables, I'd probably write it as:
$datapath = "/Users/code/data"; foreach (sort { -M $a <=> -M $b } <$datapath/*.*>) { # filename is in $_ }
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re: Open files by date created
by davorg
in thread Open files by date created
by ecuguru
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |