Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: spliting a lengthy text

by themage (Friar)
on Nov 27, 2006 at 10:26 UTC ( [id://586220]=note: print w/replies, xml ) Need Help??


in reply to splitting and coloring

Hi sanku,

I think that this code does what you need:
$a=<>; while ($a=~s/(\s?)(\w{10})(\w)/$1$2 $3/){} $a=~s/((\w+\s){5})/$1\n/g; print $a,"\n";
The code assumes that the original string comes from STDIN and the final strings goes to STDOUT. I presume you'll have no problem adapting it to your real needs.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-25 09:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found