in reply to unshifting by reference
unshift(@($this->{Memory}),$this->{Senses});
To dereference the array ref, you need curlies, not parentheses, i.e. @{$this->{Memory}}
my $this = { Memory => ["foo"], Senses => "bar", }; unshift @{$this->{Memory}}, $this->{Senses}; use Data::Dumper; print Dumper $this; __END__ $VAR1 = { 'Senses' => 'bar', 'Memory' => [ 'bar', 'foo' ] };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: unshifting by reference
by palkia (Monk) on Dec 16, 2011 at 00:43 UTC | |
by Eliya (Vicar) on Dec 16, 2011 at 00:51 UTC | |
by ikegami (Patriarch) on Dec 16, 2011 at 01:36 UTC | |
by ikegami (Patriarch) on Dec 16, 2011 at 01:37 UTC |