use strict; use warnings; use Date::Manip; use File::stat; my $yesterday = ParseDate( 'yesterday midnight' ); my $today = ParseDate( 'today midnight' ); my $yesterday_midnight = &UnixDate( $yesterday, "%s" ); my $today_midnight = &UnixDate( $today, "%s" ); my @yesterday_files = (); foreach my $file ( <*> ) { my $stat = stat( $file ) or die "Cannot stat file $file: $!\n"; my $creation_date = $stat->ctime; push( @yesterday_files, $file ) if ( $creation_date < $today_midnight and $creation_date > $yesterday_midnight ); } foreach my $file (@yesterday_files) { # process, copy, ... }