in reply to for loop localisation bug?

You already have one good answer, but another way to test would be to set $n to some value (say, 255) before the loop, and see what prints out.

--t. alex
Life is short: get busy!

Replies are listed 'Best First'.
Re^2: for loop localisation bug?
by Nkuvu (Priest) on Dec 29, 2003 at 16:11 UTC
    That's essentially what he did. $n is uninitialized before and after the loop, but not during. This doesn't change if $n was set to a value (other than the lack of an Unitialized warning).

    Output from my test (in which I changed my $n; to my $n = 255;):

    Perl version is: 5.008001 50 The value of the counter after the loop is 255