Hi all
I tried this and it seems to be working fine
my $length = $#array; my $fileNR = 1; for (my $x = 0; $x < $length; $x++) { open ($fileNR, ">$fileNR.txt") or die "can't open"; print $fileNR "$array[$x]\n"; if ($x % 1000 == 999) { close ($fileNR); $fileNR++; } }
Except that it doesn't print line 1 - 1000 to a file(as it should do), it just prints every 1000th line in a file, and then it goes on to the next file. Any idea why this happens?
In reply to Re^2: Splitting a text file
by Dr Manhattan
in thread Splitting a text file
by Dr Manhattan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |