Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

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?

What's my password?
Create A New User
[Corion]: TCLion: I'm not aware of a better way than manually building the hash, as all strptime incarnations I know have nasty edge cases
[davido]: And remember; time is hard. :) As soon as you think, I've got this, you'll discover that time is harder than that. :)
[1nickt]: TCLion are you parsing the dates with DateTime or another tool?
[1nickt]: I note DateTime::Format:: Flexible, announced immediately below this box in the CPAN feed

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (10)
As of 2017-03-23 14:42 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (287 votes). Check out past polls.