When I realized that, I thought this explained the behaviour. But the problem is, the regex at the top of the script is not the last regex, since there has been a successful match with /$last/ previously. I have tried replacing the "useless" match with this:
And the message does appear twice at the start, but does not appear when the special behaviour of m// is triggered.my $supported = '4.0.0,4.0.1,4.1.0,4.1.1,4.1.2'; $supported =~ /\Q4.1.2\E(?{say '>>> In the regex'})/ if @ARGV; "4.1.2" =~ //;
In all cases, use warnings; would have prevented this issue though.
Edit: ... the (?{ }) block is never reached in the call to /$last/ because the first half of the regex does not match. PEBKAC
In reply to Re^2: Side effect of using undefined variable in regex
by Eily
in thread Side effect of using undefined variable in regex
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |