Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: @array elements multiplication with another array elements.

by tobyink (Abbot)
on Oct 31, 2012 at 07:51 UTC ( #1001621=note: print w/replies, xml ) Need Help??


in reply to Re^2: @array elements multiplication with another array elements.
in thread @array elements multiplication with another array elements.

It uses a prototype of &\@\@. That means the two arrays get implicitly turned into arrayrefs by the Perl parser. The body of the sub just sees a coderef and two arrayrefs - not a flattened list. See perlsub.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Replies are listed 'Best First'.
Re^4: @array elements multiplication with another array elements.
by grizzley (Chaplain) on Oct 31, 2012 at 08:31 UTC
    That's true! Wow, thanks, first example of prototypes being useful
    c:\>perl -le "sub f(\@\@) { print 'array ', ++$cnt ,': ', join ' ', @$ +_ for @_ } @a=(1..5, 11,12);@b=(13..15); f @a, @b" array 1: 1 2 3 4 5 11 12 array 2: 13 14 15

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1001621]
help
Chatterbox?
[erix]: choroba: pretty impressive! :)
LanX imagines which nations would be dominating if the winter olympics were invented in East Asia
[LanX]: Corion: and that's the clue how Germany can dominate Handball tournaments, just continuing the domestic league and forbidding the best players of the world to attend :)
LanX (which would be a good scheme for England and football too)
[LanX]: If "Canada will play the Czech Republic for bronze on Saturday", that means Germany will play Syria in disguise...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2018-02-23 16:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (303 votes). Check out past polls.

    Notices?