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