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

Re: Rosetta code: Split an array into chunks

by GrandFather (Sage)
on Sep 25, 2010 at 09:54 UTC ( #861940=note: print w/replies, xml ) Need Help??


in reply to Rosetta code: Split an array into chunks

I'd have thought the idiomatic Perl solution would splice:

sub chunky { my ($n, @strs) = @_; my $str = ''; $str .= join (' ', splice @strs, 0, $n) . "\n" while @strs; return length $str ? $str : "\n"; }
True laziness is hard work

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://861940]
help
Chatterbox?
[hippo]: Marketing should not be allowed near such utilities.
[Corion]: I should tell them about the "dim+lock all monitors to show the immediate alert centered" feature of that software so they can announce the next intranet website feature even better ;)
[Eily]: This sounds like the perfect medium to send "don't let anything distract you"
[LanX]: hippo you asked about translating Asterix ?

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (14)
As of 2017-05-24 14:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?