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

Answer: How can I split a line close to a certain length, but on a word boundary?

by poznick (Initiate)
on Apr 25, 2000 at 02:07 UTC ( #8822=categorized answer: print w/replies, xml ) Need Help??

Q&A > strings > How can I split a line on word boundaries closest to a certain length? - Answer contributed by poznick

and true to the perl motto, here's yet another (much simpler) way to do it:
@text = $messagebody =~ /(.{1,140}\W)/gms;

  • Comment on Answer: How can I split a line close to a certain length, but on a word boundary?
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2017-12-18 12:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (485 votes). Check out past polls.

    Notices?