in reply to
I can't figure out what's wrong with this foreach loop
And this is why you should use 'strict' and 'warnings' pragma in practice. You would have found the bug earlier if you had had these pragmas turned on. As you would have seen a warning saying 'undefined variable is being used.'
Comment on
pragmas are good
Replies are listed 'Best First'.
Re: pragmas are good
by
ikegami
(Patriarch)
on Mar 13, 2011 at 19:18 UTC
He does have warnings turned on, and his code doesn't issue that warning. @test is an array; it cannot be undefined.
[reply]
Re^2: pragmas are good
by
bryan172
(Novice)
on Mar 13, 2011 at 19:50 UTC
Yep, that did it. I knew it was something silly. I'll make sure to turn on strict from now on, too. Thanks again! Bryan
[reply]
In Section
Seekers of Perl Wisdom