use Time::Local; my $sec = 0; my $min = 0; my $close = 17; ## 5:00 pm my $open = 9; ## 9:00 am my $spd = 24 * 60 * 60; my $yes = time - timelocal( $sec, $min, $close, (localtime( time - $spd ))[ 3, 4, 5 ] ); my $morning = time - timelocal( $sec, $min, $open, (localtime)[ 3, 4, 5 ] ); my $dir = '/'; ## where the files reside( rem ending slash ) my @cellsites; opendir CELLSITES, $dir or die "opendir"; @cellsites = map{ $_->[0] } grep{ $_->[1] <= $yes && $_->[1] >= $morning } map{ [ $_, ( ( -M "$dir$_" ) * $spd ) ]} readdir CELLSITES; closedir CELLSITES; ## print @cellsites to a file ## or to screen, or something