Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Non-destructive array processing

by jdporter (Canon)
on Jan 21, 2003 at 22:28 UTC ( #228869=note: print w/ replies, xml ) Need Help??


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.


Comment on Re: Non-destructive array processing
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://228869]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2015-07-06 00:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (68 votes), past polls