The code you supply does not compile, the asterisk is in the wrong place, should be
. However, what the others are driving at is that using
on a file handle is rather dubious. With
(rather than my) the value goes out of scope, not the variable which remains a global. Nevertheless, Perl should still flush the buffer on close.