On Dec 31, 2007 1:29 PM, Jeremy Kister <[EMAIL PROTECTED]> wrote: > what is a correct way to use a variable as an operator ?
There is no correct way to use a variable as an operator. > my $regex = 'word'; > my $modifier = 'i'; > my $string = 'a string that has Words in it'; > > if($string =~ /$regex/$modifier){ > print "match\n"; > } This is why '(?i)' was invented. You want something like this: my $word = 'word'; my $modifier = '(?i)'; my $string = 'a string that has Words in it'; if ($string =~ /$modifier$word/) { print "match!\n"; } Hope this helps! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/