in reply to Re: numbered sourcecode listing (oneliners)
in thread numbered sourcecode listing (oneliners)

You can omit the caret in that one too.
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print
  • Comment on Re: Re: numbered sourcecode listing (oneliners)

Replies are listed 'Best First'.
Re: Re: Re: numbered sourcecode listing (oneliners)
by merlyn (Sage) on Jul 21, 2001 at 13:04 UTC
    You can omit the caret in that one too.
    Only if I was golfing and not worried about being clear and working in all circumstances. I never trust the empty match, since it depends on the most recent successful match. True, here, it defaults to an empty string, but why count on that when one single character fixes that problem and communicates the proper intent?

    -- Randal L. Schwartz, Perl hacker

      In Perl "// == /$&/". Is it unintentional or useful feature? I can't imagine any situation when this feature is helpful.
      Because you were in the midst of a golfing match.
        Because you were in the midst of a golfing match.
        No, I wasn't. Read the thread carefully. I responded for my simple mechanism in response to a snippets posting. Part of that posting suggested that some of the original ideas might be good golfing, but that's not where I went with it.

        So, if not golfing, then practice safe regex. {grin}

        -- Randal L. Schwartz, Perl hacker