On 12/31/2007 7:10 PM, Chas. Owens wrote:
Use the embedded pattern-match modifier. See perldoc perlre or
http://perldoc.perl.org/perlre.html#'(%3fpimsx-imsx)' for more
information.
That's good info, thanks for the pointer!
--
Jeremy Kister
http://jeremy.kister.net./
--
To unsubscribe, e-mai
On 12/31/2007 7:09 PM, Tom Phoenix wrote:
There is no correct way to use a variable as an operator.
[...]
This is why '(?i)' was invented. You want something like this:
perfect. Thanks!
--
Jeremy Kister
http://jeremy.kister.net./
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional
yitzle wrote:
my $regex = 'word';
my $regex2 = 'Word';
my $modifier = 'i';
my $string = 'a string that has Words in it';
print "match\n" if($string =~ s/$regex/$modifier/);
print "match2\n" if($string =~ s/$regex2/$modifier/);
You were missing the leading 's' for substitute and the final backsl
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 "ma
On Dec 31, 2007 4:29 PM, Jeremy Kister <[EMAIL PROTECTED]> wrote:
snip
> if($string =~ /$regex/$modifier){
snip
Use the embedded pattern-match modifier. See perldoc perlre or
http://perldoc.perl.org/perlre.html#'(%3fpimsx-imsx)' for more
information.
#!/usr/bin/perl
use strict;
use warnings;
m
my $regex = 'word';
my $regex2 = 'Word';
my $modifier = 'i';
my $string = 'a string that has Words in it';
print "match\n" if($string =~ s/$regex/$modifier/);
print "match2\n" if($string =~ s/$regex2/$modifier/);
You were missing the leading 's' for substitute and the final backslash.
--
To uns
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 =~ /$r
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,
--