Paul Nowosielski wrote: > Dear All, Hello,
> I have a perl script that runs nightly. It create a data feed. The script > will > die if the is a + sign in the fields its parsing. > > Here is the snippet: > > while (($PKEY, $MGMTCMNT, $manager_id, $MGMTNM, $UPDATE1, $UPDATE2) = > $sth->fetchrow_array) { > $comment = ""; > if ($MGMTCMNT =~ /$MGMTNM/) { > $len = length($MGMTNM); > $start = index($MGMTCMNT, "$MGMTNM ("); > $start += $len + 2; > $end = index($MGMTCMNT, ")", $start) - $start; > $comment = substr($MGMTCMNT, $start, $end); > } > if ($UPDATE1 > $artisttime || $UPDATE2 > $artisttime ) { > print (ARTMGRFILE "$PKEY\t$manager_id\t$comment\n"); > } > } > > Here is the error message: > > Quantifier follows nothing in regex; marked by <-- HERE in m/+ <-- HERE 1 > Public Relations/ at /srv/www/htdocs/admin/utilities/aeg/manart.pl line 102. > > In this error the problem file had the text "+1 Public Relations"; > > Is there a way to escape this character so in the future it won't kill the > script? Yes, you can use the quotemeta escape sequence. Just change: if ($MGMTCMNT =~ /$MGMTNM/) { To: if ($MGMTCMNT =~ /\Q$MGMTNM/) { John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>