Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: How to pass two arrays to a sub?

by Hue-Bond (Priest)
on Oct 18, 2006 at 11:34 UTC ( [id://579035]=note: print w/replies, xml ) Need Help??


in reply to Re: How to pass two arrays to a sub?
in thread How to pass two arrays to a sub?

The code above protects your original data against changes in the called subroutine by allocating new anonymous arrays, filling them with the data from the original arrays, and only passing references to the new anonymous arrays to the subroutine. In general, that's a good thing.

But it doubles the memory requirement for the arrays so it may not be an option if the arrays are large.

--
David Serrano

Replies are listed 'Best First'.
Re^3: How to pass two arrays to a sub?
by cdarke (Prior) on Oct 19, 2006 at 14:23 UTC
    True. I was trying to be as similar as possible to the original code to make it easier to understand.
    From the supplied question I can't really tell if the local copy is needed or not, so I played safe.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (1)
As of 2024-04-25 19:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found