in reply to Re: Stripping characters from strings
in thread Stripping characters from strings

Is the g needed in this case? Wouldn't this only match the end of line once?
  • Comment on RE: Re: Stripping characters from strings

Replies are listed 'Best First'.
RE: RE: Re: Stripping characters from strings
by extremely (Priest) on Oct 30, 2000 at 04:36 UTC
    With an anchor that isn't within an alteration, "g" is pretty useless. I'm not near a perl with Debugging turned on so I can't tell you if it's a no-op, but I do know it isn't a dangerous thing to have on there, just useless. =)

    Update... And what merlyn said below. (yeesh $*)

    --
    $you = new YOU;
    honk() if $you->love(perl)

      Actually, if $* is 1, then $ matches any embedded newline as well as the end of the string, so s/.$//g; actually makes sense!

      I doubt that was the case here, though. {grin}

      -- Randal L. Schwartz, Perl hacker