use strict; # DO THIS! (by the way, you missed that one..) use warnings; # haha and that too.. use Lingua::EN::Sentence; my $page_sentence_count = 45; # 45 sentences per page! my $sentences=get_sentences($text); ## Get the sentences. for (my $scount = 0; $scount < scalar @$sentences; $scount++) { unless ($scount % $page_sentence_count) { print "Next page!\n"; # do whatever you want here (say, open next file etc) } print $sentences->[$scount] . "\n"; }