#!/usr/local/bin/perl use strict; my $mydir = "/mypath/directory"; my $new_one = 0; opendir(DIR, $mydir) or die("..."); while (my $file = readdir(DIR)) { if (-M $mydir . '/' . $file < 0.5) { $new_one = 1; last; } } closedir(DIR); print "$new_one\n";