Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Weirdness (duplicated data) while building result during parsing using regex

by Krambambuli (Curate)
on Sep 02, 2016 at 09:00 UTC ( #1171038=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1171038]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2021-10-21 19:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (83 votes). Check out past polls.

    Notices?