in reply to Re: Variable Filehandles
in thread Variable Filehandles

It is also an enormous speed hit, and you can already do that, either by using Symbol and then calling gensym, or with the following:
my $fh = do {local *FH}; my $file = "foo.txt"; open ($fh, "> $file") or die "Cannot write '$file': $!"; print $fh "Hello world\n";
And yes, you can keep filehandles in arrays, etc.

But note that if you try to abuse this, you could run out of filehandles in your program. If lots of programs all open lots of filehandles, you could run out of filehandles on your machine. So it is best to not leave a million of these open...