I'd store all the file handles in a hash, indexed by subcategory. When all is over, you then can close them, foreach value in the hash.
my %fh; # hash of filehandles while ( <> ) { # do something to find out the $subcat(egory) # and open the file if not done already $fh{$subcat} || open($fh{$subcat}, ">$pathtofile" or die "Aaargh: $!"; # now you can print stuff to the file print { $fh{$subcat} } @stuff; } # Close down everything close $_ foreach values %fh;
--bwana147
In reply to Re: About Filehandles
by bwana147
in thread About Filehandles
by Chady
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |