That frightens me a bit. Your substitution replaces the first occurance "ex" with "ister" in the string, no matter whether "ex" is part of "regex" or something else:
my $string = "Sometimes there are extra effects you didn't foresee whe +n using a regex."; while($string=~ m/reg(ex)/) { $string=~ s/$1/ister/; } print $string;
Output:
Sometimes there are istertra effects you didn't foresee when using a r +egister.
Istertra?
In reply to Re: Common Perl Pitfalls
by muba
in thread Common Perl Pitfalls
by Joe_
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |