On 4/10/06, Adam W <[EMAIL PROTECTED]> wrote: > 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. >
no good reason, just to make it completely equivalent to the example before it: at the end of the first, we have thre scalars and an array named @d (and a copy of everything in @_). At the end of the second, we have three scalars and an array(ref) accessable via the name '@d'. I don't think it makes sense at [EMAIL PROTECTED] is there to be used--I just thought it made for nice, neat parallelism. -- j -------------------------------------------------- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.dpguru.com http://www.engatiki.org values of β will give rise to dom!