in reply to Scoping question - will file handle be closed?

Should be closed. Lexical variable falls out of scope, gets undefined, and resources assigned to it are reclaimed.

As an example:

package foo { sub DESTROY { warn "Destroying object" } sub new { warn "Creating object"; return bless {}, $_[0]; } } warn "Before block"; { my $obj = foo->new; } warn "After block";

The same basic concept lives around any lexical variable, including lexical file handles.

--MidLifeXis