use IO::File; my $fh = IO::File->new('foo', 'r'); # do something with $fh undef $fh; #### # continuing from above $fh->close; #### # The output is something like IO::File=GLOB(yadda yadda) print "$fh" if defined $fh; #### my @lines = IO::File->new('foo')->getlines;