Thanks.### this file is called regex.pl my $testVar; $testVar = "January"; ### read this file open(FH,"<regex.pl") or die "cannot open file"; my @myself = <FH>; close(FH); ### make $pattern: $testVar $myself[2]=~/([^ ]+)/; my $pattern = $1; print "Pattern: $pattern\n"; ### print lines with this pattern for(@myself) { print if /$pattern/; }
In reply to regex search fails by stephanm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |