in reply to Re^2: Using lookaround with variables
in thread Using lookaround with variables
The following doesn't work:while (<MYFILE>) { $line = $_; if( $line =~ m/(?<!$pre)$searchTerm(?!$post)/ ) {print $line}; }
Any ideas why??while (<MYFILE>) { $line = $_; if( $line =~ m/(?<!$pre)$searchTerm(?!$post)/ ) {print $line}; if ($pre = "" and $post = "") { print "Case 1"; } elsif ($pre = "") { print "Case 2"; } elsif ($post = "") { print "Case 3"; } else { print "Case 4"; } print "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Using lookaround with variables
by GrandFather (Saint) on Dec 17, 2008 at 19:01 UTC | |
|
Re^4: Using lookaround with variables
by mwunderlich (Initiate) on Dec 17, 2008 at 14:49 UTC |