Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

forcing line-wraps?

by dusk (Friar)
on Feb 19, 2001 at 02:19 UTC ( #59291=perlquestion: print w/replies, xml ) Need Help??

dusk has asked for the wisdom of the Perl Monks concerning the following question:

Fellow devotees of the divine sect of Perlaism, I am having trouble, and I would appreciate any help. I am trying to get perl to append a newline after input of 80 words. Any suggestions will help :)

Replies are listed 'Best First'.
Re: forcing line-wraps?
by merlyn (Sage) on Feb 19, 2001 at 02:36 UTC
Re: forcing line-wraps?
by eg (Friar) on Feb 19, 2001 at 02:38 UTC

    Eighty words or eighty characters?

    If it's the latter, use Text::Wrap. If it's the former, um, split on /\s+/ and splice or concatentate newlines to the appropriate places. Something like (untested):

    for (my $i=79; $i<$#array; $i+=80) { $array[$i] .= "\n"; }

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://59291]
Approved by root
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2022-12-08 10:42 GMT
Find Nodes?
    Voting Booth?

    No recent polls found