in reply to How can you check to see if a file handle is already open?

Good Morning agent_smith, I would address this problem by building a hash of file handles as I read through the data. The hash keys would be the dates, and the hash values would be the file handle (references). I might write it something like this: (warning, untried)
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; }
To close them, just loop through the hash and close each entry.