nbtrap has asked for the wisdom of the Perl Monks concerning the following question:
Upgrading to 5.18 has caused "Use of uninitialized value in subtraction (-)..." to be printed when executing the following code:
while ($buf =~ /$pat/gp) { push @{ $self->{seen} }, [(pos $buf) - length ${^MATCH}, pos $buf] if not $sub or $sub->(substr ${^PREMATCH}, -200); }
I'm certain that the uninitialized value it refers to is that of ${^MATCH}, but I can't for the life of me figure out why it thinks it's undefined.
The chunk of code falls within the context of a larger subroutine, and I've been unable to recreate the error message except during regular execution of the program of which it is a part.
The only sort of "use VERSION" declaration in the entire program is "require 5.010" in a base package. And the code worked fine before upgrading to 5.18. Any ideas?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Upgrade to 5.18 causes uninitialized ${^MATCH}
by dave_the_m (Monsignor) on May 28, 2013 at 08:50 UTC | |
by dave_the_m (Monsignor) on May 28, 2013 at 11:08 UTC | |
by cdarke (Prior) on May 28, 2013 at 13:25 UTC | |
by nbtrap (Sexton) on May 29, 2013 at 01:55 UTC | |
|
Re: Upgrade to 5.18 causes uninitialized ${^MATCH}
by AnomalousMonk (Archbishop) on May 28, 2013 at 02:24 UTC | |
|
Re: Upgrade to 5.18 causes uninitialized ${^MATCH}
by kcott (Archbishop) on May 28, 2013 at 03:00 UTC | |
by nbtrap (Sexton) on May 29, 2013 at 01:54 UTC |