in reply to Posting Program

You may also consider splitting your text into separate sentences rather than lines. I believe this should make even more sense if you display an article across multiple pages. This way, you won't end up splitting a sentence in the middle etc.

The module that would let you do this is Lingua::EN::Sentence. I have already used the module in a few applications of my own to great success. For example, to spilt a piece of text in chunks of 45 sentences each, you could do the following:
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"; }
Disclaimer: code not tested (couldn't test it well on this box)

UPDATE: In reply to Re:Re:Posting Program
Ahh, for that, just use the set_EOS() method of the module to specify a new 'end-of-sentence' string.

_____________________
$"=q;grep;;$,=q"grep";for(`find . -name ".saves*~"`){s;$/;;;/(.*-(\d+) +-.*)$/; $_=["ps -e -o pid | "," $2 | "," -v "," "];`@$_`?{print"+ $1"}:{print" +- $1"}&&`rm $1`; print$\;}

Replies are listed 'Best First'.
Re: Re: Posting Program
by Jemts (Monk) on May 25, 2002 at 16:55 UTC
    The page I am printing to has a width limit of 100 characters, at font size 2. So there could be more than one sentence per line.

    Jemts

    "If you're traveling in a time machine, and you're eating corn on the cob, I don't think it's going to affect things one way or the other. But here's the point I'm trying to make: Corn on the cob is good, isn't it."