in reply to Re^2: Mysterious append failure.
in thread Mysterious append failure.
Was forgetting for a minute that declaring $b there would actually scope it inside the loop.This isn't quite true - the output of Deparse is wrong. The lexical is scoped wider than the loop, as can be seen here:
(Note that $::x isn't printed, the lexical $x is instead.) However, the initialising and releasing of $x is scoped to within the loop.$ perl585 -le '$x=99; my $x = $_ for 1..3; print $x' $
That may be construed as a bug. There again, statement modifiers on my declarations are usally buggy, and are best avoided.
Dave.
In Section
Seekers of Perl Wisdom