http://www.perlmonks.org?node_id=228869


in reply to Non-destructive array processing

Hey, that's a neat trick! But how about:
my @array = 1..10; sub { while ( my @chunk = splice @_, 0, 2 ) { print "Chunk: @chunk\n"; } }->( @array ); print "Original array is still intact! (@array)\n";

jdporter
The 6th Rule of Perl Club is -- There is no Rule #6.