Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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 :

Replies are listed 'Best First'.
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.)

    - (do not use).

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2019-07-20 07:14 GMT
Find Nodes?
    Voting Booth?

    No recent polls found