my $fp;
open($fp, '>', 'hoge.txt') or die;
foo($fp);
close($fo);

sub foo($)
{
my $fp = shift;
while (<$fp>) {
# hogehoge
}
}

これって駄目なのかな