Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: creating 2D arrays

by PrakashK (Pilgrim)
on Jul 24, 2001 at 21:18 UTC ( #99416=note: print w/replies, xml ) Need Help??

in reply to creating 2D arrays

As has already been explained by others, a reference must be used in place of an array itself.

I'd like to add just one thing. For performance reasons, i'd rather change the sub mult to return the array reference rather than the array itself. Also, pass an array reference as the second param to mult instead of an array.

sub mult { my ($a, $b) = @_; # dereference the array, process it and create a new array .... return \@c; } ## Assuming that the array @b is a 2D array too for $i (0..$N){ push @results, mult($a, $b[$i]); }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://99416]
[talexb]: So low end these days means quad core? Jeepers.
[jedikaiti]: 'mornin, Monks
[Corion]: talexb: Well, low end for desktops :-D
[marto]: hey jedikaiti

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2017-07-27 15:27 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (418 votes). Check out past polls.