in reply to array reference
Why not just try it? ...
use strict; use warnings; use Data::Dumper; my $parray = [ qw( a b c ) ]; printf "Array before change is: %s\n", Dumper($parray); my $phash = { 'array' => $parray, }; printf "Hash before change is: %s\n", Dumper($phash); push @$parray, 'd', 'e', 'f'; printf "Array after change is: %s\n", Dumper($parray); printf "Hash after change is: %s\n", Dumper($phash);
The results indicate that you do NOT need to do anything manually:
Array before change is: $VAR1 = [ 'a', 'b', 'c' ]; Hash before change is: $VAR1 = { 'array' => [ 'a', 'b', 'c' ] }; Array after change is: $VAR1 = [ 'a', 'b', 'c', 'd', 'e', 'f' ]; Hash after change is: $VAR1 = { 'array' => [ 'a', 'b', 'c', 'd', 'e', 'f' ] };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: array reference
by ikegami (Patriarch) on Aug 22, 2007 at 15:29 UTC |