Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Understanding Split and Join

by mvcorrea (Novice)
on Jul 16, 2014 at 11:57 UTC ( #1093854=note: print w/ replies, xml ) Need Help??


in reply to Understanding Split and Join

Looking 4 wisdom in a situation.. I have a huge string. I need to split the text at max col80 "{80}" in the space(without breaking the words). If we find "/\.\s/" (dot space) should be a nice place to spit it. tks in advance,


Comment on Re: Understanding Split and Join
Re^2: Understanding Split and Join
by Athanasius (Monsignor) on Jul 16, 2014 at 16:16 UTC

    Have you looked at the FAQ, How do I reformat a paragraph? The core module Text::Wrap may be all you need:

    use strict; use warnings; use Text::Wrap qw($columns wrap); $columns = 80; print wrap('', '', <DATA>); __DATA__ The quick brown fox jumped over the lazy dog. The quick brown fox jump +ed over the lazy dog. The quick brown fox jumped over the lazy dog. T +he quick brown fox jumped over the lazy dog. The quick brown fox jump +ed over the lazy dog. The quick brown fox jumped over the lazy dog. T +he quick brown fox jumped over the lazy dog. The quick brown fox jump +ed over the lazy dog. The quick brown fox jumped over the lazy dog. T +he quick brown fox jumped over the lazy dog. The quick brown fox jump +ed over the lazy dog.

    Output:

    2:13 >perl 935_SoPW.pl The quick brown fox jumped over the lazy dog. The quick brown fox jump +ed over the lazy dog. The quick brown fox jumped over the lazy dog. The quick +brown fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog +. The quick brown fox jumped over the lazy dog. The quick brown fox jumped o +ver the lazy dog. The quick brown fox jumped over the lazy dog. The quick brow +n fox jumped over the lazy dog. The quick brown fox jumped over the lazy dog +. The quick brown fox jumped over the lazy dog. 2:13 >

    Hope that helps,

    Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1093854]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2014-12-18 01:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (41 votes), past polls