ManFromNeptune has asked for the wisdom of the Perl Monks concerning the following question:
$criteria = "(abc|123)\$"; $teststring = "Foo walks up and says: abc"; if ( $teststring =~ /$criteria/ ) { print "it worked!\n"; }
....but that seems like a hack. Is there a better way to do this aside from eval (which has its own problems, particularly if $criteria is being defined through a user-specified value from a web page).$teststring =~ /($criteria)/
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: $scaler inside a RegEx
by mikeraz (Friar) on Aug 05, 2005 at 00:15 UTC | |
by ikegami (Patriarch) on Aug 05, 2005 at 00:43 UTC | |
|
Re: $scaler inside a RegEx
by polypompholyx (Chaplain) on Aug 05, 2005 at 10:47 UTC |