in reply to Re: 'my' headache...why doesn't this work?
in thread 'my' headache...why doesn't this work?

That's works....I guess I understand the FOR issue. Still would'a thunk that strict would have gagged on it.

======================
Sean Shrum
http://www.shrum.net

  • Comment on Re: Re: 'my' headache...why doesn't this work?

Replies are listed 'Best First'.
Re: Re: Re: 'my' headache...why doesn't this work?
by thelenm (Vicar) on Apr 05, 2002 at 17:25 UTC
    strict is smart enough to detect variables that are not properly declared, but not necessarily to detect variables that are logically misused. In this case, declaring a 'my' variable inside a for loop is perfectly legal (in fact, I do it all the time without thinking much about it), e.g.
    foreach my $foo (@ary) { . . . }
    But for a running summation, of course it's not what you want. So strict doesn't see a problem; although it's misused, the variable is properly declared.