Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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

( #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?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2016-07-28 06:35 GMT
Find Nodes?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?

    Results (253 votes). Check out past polls.