in reply to Re: Re: Path to enlightment
in thread Path to enlightment

s/^(\d+:)//;

Minor nit.. you don't need to do the grouping. And, although he didn't say it he may also want the whitespace removed after the colon.

s!^\d+:\s+!!;

Cheers,
KM

Replies are listed 'Best First'.
useless o modifier (Re: Path to enlightment)
by tye (Sage) on Jan 23, 2001 at 23:53 UTC

    s!^\d+:\s+!!o;
    I added the o modifier, since the pattern doesn't change, may as well compile it once for the loop.

    The o modifier is a no-op on a regex that doesn't contain any interpolated variables, BTW.

            - tye (but my friends call me "Tye")
      Whoops, you are correct. The /o would be a no-op. This is what happens when you are doing ten things at once :)

      Cheers,
      KM

Re: Re: Re: Re: Path to enlightment
by spaz (Pilgrim) on Jan 24, 2001 at 00:17 UTC
    The 'o' modifier on your regexp is useless as it applies to regexp's that contain variables in them. From the Camel

    PATTERN may contain variables, which will be interpolated (and the pattern recompiled) every time the pattern search is evaluated....mentioning /o constitutes a promise that you won't change the variables in the pattern. If you do change them, Perl won't even notice.