use strict; use warnings; my $fh = do {local *FOO}; open $fh, "somefile"; my $sc = *$fh{IO}; print <$sc>;