foreach (sort {-M $a <=> -M $b} <*>) { # ... } #### $oldest = 5; # Days $newest = 1; foreach (<*>) { next unless (-M $_ < $oldest && -M $_ > $newest); # Do stuff } #### $oldest = 5; # Days $newest = 1; foreach (grep {-M $_ < $oldest && -M $_ > $newest} <*>) { # Do stuff }