There's only a single space in "Oct 26" in your test data, but two spaces in your regexp. The following prints "match":
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:1 +2:41 2007"; if ( /^ERROR/ && /$month $day/ ) { print "match\n" }
Note that // matches against $_ by default.
In reply to Re: File line matching
by FunkyMonk
in thread File line matching
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |