stephanm has asked for the wisdom of the Perl Monks concerning the following question:
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/; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex search fails
by jethro (Monsignor) on Mar 12, 2009 at 14:39 UTC | |
by ikegami (Patriarch) on Mar 12, 2009 at 15:09 UTC | |
|
Re: regex search fails
by friedo (Prior) on Mar 12, 2009 at 14:41 UTC | |
by stephanm (Sexton) on Mar 12, 2009 at 23:03 UTC |