foreach ( @directories_time_tagged ) { $directory_name = $_; if ($directory_name =~ /(\d\d\d\d)_(\d\d)_(\d\d)_(\d\d)/) { # Year_month_day_hour $year = $1; $month = $2; $day = $3; $hour = $4; } my $date_time = ; # The time indicated by $year $month $day $hour my $now = ; # Not sure how to get this value if ($date_time => $now ) # If the date has been passed { print "\nconditions have been met\n";