in reply to Splitting a text file
Hi,
you are already on the right track. You might try to adapt your algorithm as follows (to keep most of your ideas/code)
- open output-file #1
- loop through the array (as in your code; for (my $x = 0; $x < $length; $x++))
- write the current line ($array[$x])
- check if you already wrote 1000 lines (use the modulo-operator, e.g. if ($x % 1000 == 999))
- close the current file
- open the next one
- clean-up: close the last file
In Section
Seekers of Perl Wisdom