Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Answer: How can I split a string into chunks of size n bytes?

by Aristotle (Chancellor)
on Oct 02, 2003 at 23:55 UTC ( #296126=note: print w/replies, xml ) Need Help??


in reply to Answer: How can I split a string into chunks of size n bytes?
in thread strings

And in case you don't care whether the last group is complete,
my @groups = unpack "a$n" x ( ( length($string) / $n ) - 1 ) . "a*", $ +string;

Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://296126]
help
Chatterbox?
LanX is on a protloose
[shmem]: protloose? can't parse that
[choroba]: neither can I
[choroba]: and the first Google hit is tagged "human feces" :-o
[choroba]: oh, missed the double o
[shmem]: "brotlos"?
[shmem]: heavy protein discharge?

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2017-08-17 09:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Who is your favorite scientist and why?



























    Results (286 votes). Check out past polls.

    Notices?