in reply to Problems writing to filehandles contained in variables

merlyn's advice will get you over this hump, but I still wonder whether you really need to have so many files open at the same time. As I recall from your earlier post, you were looping over hashes, such that at each iteration, one of the hash values would tell you which file to write to on that iteration -- here's a summary of the relevant parts of your code:
# open three file handles, for NT page, UNIX page, MAIL page foreach my $class ( sort keys %classHash ) { foreach my $status ( sort keys %{$classHash{$class}} ) { if ( $classname{$class} eq "NT" ) ... # set output to NT page if ( $classname{$class} eq "UNIX" ) ... # set output to UNIX page if ( $classname{$class} eq "MAIL" ) ... # set output to MAIL page ... } }
Now from the looks of that, I think the following would accomplish the same thing, but with only one file open at a time:
foreach my $page (qw/NT UNIX MAIL/) { # open output html file for this page, print the header, # maybe you open a second file for the html to "#include", # then... foreach my $class (sort grep {$classname{$_} eq $page} keys %classHa +sh ) { foreach my $status (sort keys %{$classHash{$class}}) { # print the page content, etc. } } # print the footer and close this output file(s). }
This way, you only need to be writing one output file at a time (or, as discussed in the earlier post, two files that combine to create a single web page). There's a lot less system overhead this way, and a lot less code to write (which means less code to have to maintain/fix later). I doubt that the three "sort grep {...} keys %hash" calls are going to cause any noticeable delay.