Erm . . .
@total_words = split while (<DATA>);
only works because you've got a single line of test data. With more than one line you'd wind up only getting the number of words in the last line processed. The correct way to do what you're attempting would be along the lines of push @total_words, split; however you'd then wind up keeping all of the words in memory which, given the original constraint of "very large files", is probably not going to be viable.
The cake is a lie.
The cake is a lie.
The cake is a lie.
In reply to Re^2: splitting files by number of words
by Fletch
in thread splitting files by number of words
by josephs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |