in reply to Re^2: string substitution within regular expressions?
in thread string substitution within regular expressions?

The errors don't make any sense to me, given that it works in the non-block if and only fails with block-form if. Does this work any better? Does it fail before the if?
sub findString($) { my $line = shift; my $compiled_regex = eval "qr/$regex/"; if ($line =~ /$compiled_regex/) { print "found\n"; } }

Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^4: string substitution within regular expressions?
by Anonymous Monk on Feb 09, 2005 at 18:54 UTC
    Works like a champ. Thanks!