sub mysub { my $fh = \do { local *FILE}; open($fh, ">myfile")... ... } #### sub mysub { open(my $fh, ">myfile")... ... }