Yep. Ok this is tested and works.
use warnings;
use strict;
my $count = 0;
my $filename = "file0.csv";
open (DISTLISTS, " < rdy.csv") || die "Unable host file for splitting:
+ $!.";
while (<DISTLISTS>) {
chomp $_;
if ( ($. - 1) % 200 == 0) { # modular arithmetic
$count ++;
my $filename = "file$count.csv";
open (OUTPUT1, " >$filename")
}
print OUTPUT1 "$_\n";
if ($. % 200 == 0) { # modular arithmetic
close OUTPUT1;
}
}
|