On Fri, 2006-07-21 at 16:14 -0400, [EMAIL PROTECTED] wrote: > How do I pass an array to a subroutine in a manner that the array is entirely > contained in one element of @_, instead of having each element mapped to > elements of @_. > > for example, inside of the subroutine, I'd like to say > @z = @_[0]; > and have @z refer to the entire array I passed to the subroutine, rather than > just the first element which is the case now.
see: perldoc perlref Pass a reference to the array in to the sub: sub test_array { my($array) = shift; ${$array}[0] = 'First Element'; push @{$array}, 'New Element'; } my @array = qw( first second third ); test_array([EMAIL PROTECTED]); print $array[0] . "\n"; -- Joshua Colson <[EMAIL PROTECTED]> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>