Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

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]
[Discipulus]: amitkumarj441 more atention you put asking, more attentio you got in answers
Discipulus 's hoping he needs a oneliner ;=)
VinsWorldcom takes a cookie from the platter on the sideboard.

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2017-04-26 20:27 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (488 votes). Check out past polls.