use Symbol qw(gensym); # ... open +(my $fh = gensym), "<$filename";