in reply to I've read perlref
But I think your biggest problem is the first line of thing, where you say:Scalar value @Array[0] better written as $Array[0] at /tmp/t line 17. Unquoted string "some" may clash with future reserved word at /tmp/t l +ine 17. Scalar value @Array[1] better written as $Array[1] at /tmp/t line 18. Unquoted string "some" may clash with future reserved word at /tmp/t l +ine 18. Unquoted string "more" may clash with future reserved word at /tmp/t l +ine 18. main::thing() called too early to check prototype at /tmp/t line 2. Not enough arguments for values at /tmp/t line 17, near "values]" Not enough arguments for values at /tmp/t line 18, near "values]"
That makes a copy of the array. You are no longer assigning to the references to the original arguments, and thus your values are lost once you get out of the subroutine...($REF_array)=@_;
I think what you want is more akin to this:
sub thing() { ${$_[0]}[0]=([qw(some values)]); ${$_[0]}[1]=([qw(some more values)]); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: I've read perlref
by Fletch (Bishop) on Mar 11, 2004 at 13:35 UTC |