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

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

by BrowserUk (Patriarch)
on Nov 30, 2007 at 14:27 UTC ( #654122=note: print w/replies, xml ) Need Help??


in reply to How to split_and_pad string to n-th chars pieces with one regular expression?

If you must, this seems to work.

$x =~ s[(.{0,3}|)]["'$1" . (' ' x (3-length($1))) ."'\n"]ge;

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re: How to split_and_pad string to n-th chars pieces with one regular expression?
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2023-12-11 06:30 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?