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

Re: Regex split string into n-length

by johngg (Abbot)
on Sep 10, 2013 at 10:51 UTC ( #1053231=note: print w/replies, xml ) Need Help??

in reply to Regex split string into n-length

You could also use unpack.

$ perl -E ' say for map { join q{-}, unpack q{(a3)*}, $_ } qw{ 12 123 1234 12345 123456 1234567 };' 12 123 123-4 123-45 123-456 123-456-7 $

I hope this is helpful.



Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1053231]
[robby_dobby]: page for yapceu is out of date by 2 years
[robby_dobby]: LanX: Sharm-el-Sheikh is in Egypt
[robby_dobby]: Thanks, choroba
[LanX]: yes and Egypt (like Turkey and Russia) belongs to two continents
[choroba]: Also Europe and Asia are geographically one continent, the division is political
[robby_dobby]: I always thought everything on the other side of Suez to be Africa. That's an entire continent
[LanX]: Sinai_Peninsula
[robby_dobby]: choroba: If you're talking of Eurasia, it's only true of the erstwhile Constantinople/ Ottoman empire
[LanX]: yes correct, but Sinai is not on the other side

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (15)
As of 2017-04-24 16:05 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (442 votes). Check out past polls.