Jeremy Kister wrote:
what is a correct way to use a variable as an operator ?
i thought the following could work, but i get a syntax error on the
matching line.
my $regex = 'word';
my $modifier = 'i';
my $string = 'a string that has Words in it';
if($string =~ /$regex/$modifier){
print "match\n";
}
if ( $string =~ /(?$modifier:$regex)/ ){
print "match\n";
}
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/