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";
}

Thanks,

--

Jeremy Kister
http://jeremy.kister.net./

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to