in reply to segregating data from one file to many files
my $line=<FH> reads a line from the current position in the file. It doesn't start reading from the start of the file once you've reached the end. Reopen the file or seek to the beginning.
In Section
Seekers of Perl Wisdom