Dear Monks,
I have searched both this list and perlbug, and I don't find anything about this (exactly). The following code 1. works fine and the result is correct. But when I put a '+' character in front of the pattern variable in 2., I get an error.
This is reproducible on all version of perl that I have from 5.6.1 through 5.12.1
Is this an error, or should I be testing for '+' in the first position of the pattern variable? Note: I usually have no idea what /pattern/replacement/ actually contain.
1. perl -e '$in="44"; $out=$in; $out =~ s/$in//; print "Result: |$in|$out|\n";'
Result: |44||
2. perl -e '$in="+44"; $out=$in; $out =~ s/$in//; print "Result: |$in|$out|\n";'
Quantifier follows nothing in regex; marked by <-- HERE in m/+ <-- HERE 44/ at -e line 1.
Thank you
In reply to Substitution, '+' in first position of Pattern by flexvault
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |