perlquestion
nbtrap
<p>
Upgrading to 5.18 has caused "Use of uninitialized value in subtraction (-)..." to be printed when executing the following code:</p>
<code>
while ($buf =~ /$pat/gp) {
push @{ $self->{seen} }, [(pos $buf) - length ${^MATCH}, pos $buf]
if not $sub or $sub->(substr ${^PREMATCH}, -200);
}
</code><p>
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.</p>
<p>
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.</p>
<p>
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?</p>