# in simple pieces my $five_min = 5 / 60*24; # 5 minutes as part of day for M time my $dir = 'C:/devl/bin/timedir'; my @files_dirs = glob("$dir/*"); my @files = grep{ ! -d $_ } @files_dirs; my @want = grep{ ! m// and ! m// } @files; my @old = grep{ -M $_ > $five_min } @want; print "$_ is > 5 minutes old\n" for @old; # in one line: print "$_ is > 5 minutes old\n" for grep { ! -d and ! m/foo/ and ! m/bar/ and -M > 0.0035 } glob("C:/devl/bin/timedir/*");