jess195 has asked for the wisdom of the Perl Monks concerning the following question:
Why would the following happen:
%mapp = (); @arr = ("R", "T", "HH", "M"); $mapp{"FirstKey"} = \@arr; @val = $mapp{"FirstKey"}; print join (",", @{$mapp{"FirstKey"}}) . "\n"; #The array will be pr +inted push(@val, "RBB"); $mapp{"FirstKey"} = \@val; print join (",", @{$mapp{"FirstKey"}}) . "\n"; #an array reference wi +ll be printed
Output
How to solve this issue and print the new array instead of its reference?R,T,HH,M ARRAY(0x7ffafc013bf8),RBB
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Map a string to an array
by runrig (Abbot) on Nov 01, 2013 at 22:36 UTC | |
by jess195 (Novice) on Nov 01, 2013 at 22:41 UTC | |
by runrig (Abbot) on Nov 01, 2013 at 22:47 UTC | |
by AnomalousMonk (Archbishop) on Nov 02, 2013 at 08:49 UTC | |
by BrowserUk (Patriarch) on Nov 02, 2013 at 10:23 UTC |