my $date = localtime; my @fields = split /\s+/, $date; my $year = pop @fields; my $month = $fields[1]; my $day = $fields[2]; $_ = "ERROR: tablename - Description of the error Fri Oct 26 10:12:41 2007"; if ( /^ERROR/ && /$month $day/ ) { print "match\n" }