in reply to Re: Variable Filehandles
in thread Variable Filehandles
And yes, you can keep filehandles in arrays, etc.my $fh = do {local *FH}; my $file = "foo.txt"; open ($fh, "> $file") or die "Cannot write '$file': $!"; print $fh "Hello world\n";
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...
|
|---|