in reply to Some odd ambiguity in this regex
... something in the steps you are not showing us.misterperl: It's easy to contrive that scenario entirely separate from debug mode:
m//g in scalar or void context "remembers" the point at which a previous match ended and continues matching from that point. See pos.c:\@Work\Perl\monks>perl -wMstrict -le "$_ = '1223w3433.45+34'; ;; /\d\D*/g; printf qq{'$&' } while /\d\D*/g; " '2' '2' '3w' '3' '4' '3' '3.' '4' '5+' '3' '4'
Update: See what happens if the side-effect-producing, void context
/\d\D*/g;
statement is changed to
() = /\d\D*/g;
(i.e., if list context is imposed).
Give a man a fish: <%-{-{-{-<
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Some odd ambiguity in this regex (updated)
by ikegami (Patriarch) on Jun 06, 2020 at 21:11 UTC | |
Re^2: Some odd ambiguity in this regex (updated)
by misterperl (Friar) on Jun 05, 2020 at 16:59 UTC | |
by LanX (Saint) on Jun 05, 2020 at 17:17 UTC |