$fh = do {local *FH}; open ($fh, $filename) #### use strict; use warnings; use IO::Handle; my $fh; # $fh = do {local *FH}; #bad open ($fh, './test') or die("open failed: $!"); print "line: " . $fh->input_line_number(); __END__ output with "#bad" commented out: line: 0 output with "#bad" included: Can't call method "input_line_number" without a package or object reference at test line 10.