in reply to Re^2: pattern matching once
in thread pattern matching once

perldoc perlop

...

       "m/PATTERN/msixpodualngc"
       "/PATTERN/msixpodualngc"

...

       "m?PATTERN?msixpodualngc"
       "?PATTERN?msixpodualngc"

With the // or ?? delimiters the m at the beginning is optional.

Naked blocks are fun! -- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re^4: pattern matching once
by haukex (Archbishop) on Aug 11, 2023 at 17:42 UTC
    With the // or ?? delimiters the m at the beginning is optional.

    That was true until about 8 years ago. Now:

    In the past, the leading m in m?PATTERN? was optional, but omitting it would produce a deprecation warning. As of v5.22.0, omitting it produces a syntax error. If you encounter this construct in older code, you can just add m.

    Typo fix

      -- for perl golf :-(

      Naked blocks are fun! -- Randal L. Schwartz, Perl hacker
Re^4: pattern matching once
by haj (Vicar) on Aug 11, 2023 at 17:45 UTC

    I guess it's time to switch to a modern Perl?

    That seems to be gone in Perl 5.26, though I failed to spot it in perldelta.