in reply to Re: Side effect of using undefined variable in regex (updated)
in thread Side effect of using undefined variable in regex
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Side effect of using undefined variable in regex
by haukex (Archbishop) on Jul 01, 2019 at 13:23 UTC | |
by Eily (Monsignor) on Jul 01, 2019 at 14:39 UTC | |
by haukex (Archbishop) on Jul 01, 2019 at 14:59 UTC | |
by Eily (Monsignor) on Jul 01, 2019 at 15:19 UTC | |
by haukex (Archbishop) on Jul 01, 2019 at 17:29 UTC | |
by AnomalousMonk (Archbishop) on Jul 01, 2019 at 16:51 UTC | |
by haukex (Archbishop) on Jul 01, 2019 at 17:36 UTC |