http://qs1969.pair.com?node_id=158371


in reply to Breaking output lines into N-element chunks

I prefer the easy-to-read idiom:
my @data = (... long list ...); while (my @chunk = splice @data, 0, 4) { # 4 items at a time ... process @chunk ... }

-- Randal L. Schwartz, Perl hacker