Some answers to your questions
and it dies as expected. Adding the explicit @main:: solves the problem altogether.Possible unintended interpolation of @counts in string at bug line 20. Global symbol "@counts" requires explicit package name at bug line 19. Global symbol "@counts" requires explicit package name at bug line 20.
And I have another point of weirdness to note in the regex you are using you have placed a '^' caret at the END of the regexThis is weirdness, you are right and actually not necessary for the thing in question here. It is a left-over from the code where I originally encountered the problem. But I can explain the behaviour ... consider this simpler regex "ab" =~ /.^/; it matches any character and after that the beginning of the line, so it can never match! Nevertheless the regex tries to match. First the a, then it sees that that doesn't work out and so tries the b after which it fails. If we now sneak in a code block like this "ab" =~ /.(?{print 'hello!'})/; the regex passes this block twice! And you can do very nice things with that (see e.g. my twiddle code) ... the original code came from a nonogram solver which I will post here in a couple of weeks (I have to find time to clean up the code a bit :)
Update: I forgot to mention use re 'debug'. It is always helpful when you don't understand a pattern match.
-- Hofmator
In reply to Re2: Perl Bug in Regex Code Block?
by Hofmator
in thread Perl Bug in Regex Code Block?
by Hofmator
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |