in reply to How can you check to see if a file handle is already open?
To close them, just loop through the hash and close each entry.my %file_handles = (); while (<>) { chomp; my @line = split /;/; if (not defined $file_handles{$line[0]} ){ open $file_handles{$line[0]}, ">$line[0].data"; } print $file_handles{$line[0]} join "\t", @line; }
|
|---|