Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Non-destructive array processing

by elusion (Curate)
on Jan 20, 2003 at 23:53 UTC ( #228527=note: print w/ replies, xml ) Need Help??


in reply to Non-destructive array processing

I prefer Perl 6.

my @array = 1..10; for @array -> $one, $two { my @chunk = ($one, $two); print "Chunk: @chunk\n"; }
However, if I need to use Perl 5, I'd pick BrowserUK's method, or something like it. It appears a little overkill for the example, but the example is a bit contrived.

elusion : http://matt.diephouse.com


Comment on Re: Non-destructive array processing
Download Code
Re: Re: Non-destructive array processing
by Juerd (Abbot) on Jan 21, 2003 at 19:37 UTC

    I prefer Perl 6.

    So do I, so do I...

    Wouldn't for @array -> @chunk[0, 1], &foo work? With @chunk predeclared, of course. (Not that I ever need the chunk as an array. I use it only to store whatever splice returns. I love the Perl 6 syntax.)

    Juerd
    - http://juerd.nl/
    - spamcollector_perlmonks@juerd.nl (do not use).
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2014-10-23 02:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (123 votes), past polls