http://qs321.pair.com?node_id=1171038


in reply to Weirdness (duplicated data) while building result during parsing using regex

If you add an 'use Data::Dump' to your module and insert lines like
print "4 \$_: '$_'\n", "\$^N: ", dd( $^N ), "\$^R: ", dd( $^R );
after your 'push' instructions, there is clearly a difference in behavior between your example cases.

Maybe you can figure it out from there?
  • Comment on Re: Weirdness (duplicated data) while building result during parsing using regex
  • Download Code

Replies are listed 'Best First'.
Re^2: Weirdness (duplicated data) while building result during parsing using regex
by perlancar (Hermit) on Sep 02, 2016 at 10:09 UTC
    Thanks for the suggestion, I indeed forgot to try "print"-debugging at every step. Apparently there's a backtracking involved in the case of [attr() eq 1] but not in the case of [attr()=1]. I should've been suspicious of backtracking whenever some kind of "duplication" happens. Will debug this further.