Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Answer: How do I split up a long string with no spaces?

by Daddio (Chaplain)
on May 12, 2001 at 21:56 UTC ( #79958=categorized answer: print w/replies, xml ) Need Help??

Q&A > regular expressions > How do I split up a long string with no spaces? - Answer contributed by Daddio

You can also create a neat array of the strings using this:

my $string = "thisisalongstringofcharacters"; my (@strings) = split /(.{5})/,$string;

Season the '5' in the split to taste. Gives a nice array for use in whatever you need it for.

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
[Discipulus]: yes i saw your cell brother..
[Discipulus]: but now fuel is cheap and they still make some war.
[Discipulus]: capitalism is able to go to war by cycle, even.
[shmem]: some? are you jokin' ?
[shmem]: fuel is only one fuel that fuels the fools... it is all about power and control - which NOBODY will have.
[shmem]: ...can't have, since silly

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (10)
As of 2017-04-29 22:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (534 votes). Check out past polls.