[Omaha.pm] Substitution loop
Jay Hannah
jay at jays.net
Tue Jul 31 13:09:57 PDT 2007
On Jul 31, 2007, at 2:38 PM, Andy Lester wrote:
> Sure. The /g is a modifier saying "do this on everything throughout
> the string". In this case, it's removing every non-digit character
> from the string.
>
> It would be even better to have it as
>
> $dl =~ s/[^\d]+//g;
>
> That way if you have a string of ten non-digits, they'll all get
> removed at once, rather via ten checks.
>
> You can also use the tr/// operator for this sort of thing, if you
> want.
Yes, those are great tips. Thanks!
But what is a fatal "Substitution loop" error from Perl?
I've never seen that one before. It disappeared without me changing
anything and I can't make it happen again.
Probably user error. :)
j
More information about the Omaha-pm
mailing list