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

Re^4: Split a string at a given line number

by k_manimuthu (Monk)
on May 13, 2010 at 04:28 UTC ( #839770=note: print w/replies, xml ) Need Help??

in reply to Re^3: Split a string at a given line number
in thread Split a string at a given line number

For my above code spliced the 20 lines and stored in a array format. Now that's changed to add a newline character in every 20th line and stored in a scalar variable.

$new_string.="$&\n" while ($string=~ m/([^\n]+.*?\n){1,20}/gs); print "\n$new_string";

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://839770]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2017-02-20 14:49 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (297 votes). Check out past polls.