Thanks, everyone, for the thoughtful replies. I do have a followup
question (see below).
Jay Savage wrote:
($str1, $str2, $str3) = (shift, shift, shift);
@d = [EMAIL PROTECTED];
On the other hand resizes @_. Now you only have one copy of each value
in memory. For a large list, this may be important. the combination of
shift, unshift, push and pop also lets you operate on @_ as a stack,
FIFO, LIFO, or both. On the other hand, if you modify a value, the
original value is destroyed.
Here you show passing @_ as a reference to the array variable @d. Did
you mean to pass it to $d? Otherwise, I don't understand why you would
pass a reference to an array to an array (instead of a scalar).
If I understand correctly, you're saying that it makes more sense (in
this case) to change @_ to a reference, pass it to a variable, and then
dereference it later all in order to avoid having to copies of some long
list in both @d and @_. Yes?
And I understand that it doesn't matter too much compared to the
overhead of calling the subroutine in the first place, but I'm just curious.
Thanks,
Adam
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>