my $obj = MyPackage::new(); # sets $obj->{FH}='' if ('some condition') { 'do something about that'; if ('another nested block') { open my $lh, 'etc.'; $obj->getset('FH', $lh); # or maybe $obj->{FH}=$lh; } }