Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: How to split_and_pad string to n-th chars pieces with one regular expression?

by bdimych (Monk)
on Nov 30, 2007 at 15:00 UTC ( #654128=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $x=~s/(.{1,3}|^$)\n?/sprintf"'%-3s'\n",$1/eg;
    
  2. or download this
    $x=~s/(.{1,3}|^$)\n?/sprintf"'%-3s'\n",$1/meg;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2023-12-11 06:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (41 votes). Check out past polls.

    Notices?