>Hi All -

>This script:

>use strict;
>use warnings;

>my $string = 'I love c++';
>my $compare = 'some compare string';
>if ($compare =~ /$string/) {
>    print "$compare contains $string\n";
>} else {
>    print "$compare does not contain $string\n";
>}

>gives this error:

>Nested quantifiers in regex; marked by <-- HERE in m/I love c++ <-- HERE /
>at t.pl line 6.

>It's the '+'s. I've tried escaping them '\+' but then
>the regex matches on '\+'. I don't understand what is
>happening.

>This is occuring in a script that's manipulating
>files; file names with '+'s fail on this error. Is there any
>way I can fix this before I fall back to substrings and
>'eq'/'ne' compares (ugh).

>Aloha => Beau;

See if this works 

if ($compare =~ /\Q$string\E/) {

Shishir

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to