jroberts has asked for the wisdom of the Perl Monks concerning the following question:
will actually undef all of the the elements in $a. Not what I expected... I expected that (@{$a}) would result in a list of the elements of $a and $i would take on the value of each of the elements, not a reference to the elements. If I said something like$a = ['a', 'b', 'c']; for $i (@{$a}) { undef $i; }
@x would have the elements of $a not the refs... This seems very odd to me. Am I alone in this thinking?@x = @{$a} -OR- @x = (@{$a})
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using Array Refs
by Transient (Hermit) on May 05, 2005 at 14:25 UTC | |
|
Re: Using Array Refs
by ikegami (Patriarch) on May 05, 2005 at 14:27 UTC | |
|
Re: Using Array Refs
by polettix (Vicar) on May 05, 2005 at 14:26 UTC | |
|
Re: Using Array Refs
by gellyfish (Monsignor) on May 05, 2005 at 14:40 UTC | |
|
Re: Using Array Refs
by danielcid (Scribe) on May 05, 2005 at 14:47 UTC |