Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2021-12-01 14:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (10 votes). Check out past polls.

    Notices?