in reply to Re: Why the variable $n was undef?
in thread Why the variable $n was undef?

That may be true, but it's complete irrelevant. $n isn't the loop variable, $_ is.

IMO, this is a bug. Either there's an assumed block around the statement, or there isn't. If there is, the use of $n afterwards should be a compile time error; if it isn't, $n should be 2 afterwards. (As if the my wasn't in the same line).