in reply to Re: Reset meaning of empty pattern?
in thread Reset meaning of empty pattern?

Can't test now, but probably this one has side effects by setting $1.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Replies are listed 'Best First'.
Re^3: Reset meaning of empty pattern?
by tybalt89 (Monsignor) on Sep 01, 2018 at 16:45 UTC

    That's why I posted the other ones.

    On the other hand, does it really matter? If the user does not expect $1 to be set by //, whether it has a value or is undef is irrelevant.

      On the other hand, does it really matter?

      It does to me, since I inspect the results of the regex, including @+ to see how many capture groups there were.

      $ perl -wMstrict -le '""=~// or die; print for @+' 0 $ perl -wMstrict -le '""=~/(?:)/ or die; ""=~// or die; print for @+' 0 $ perl -wMstrict -le '""=~/()/ or die; ""=~// or die; print for @+' 0 0

      Updated examples.