in reply to Re^2: Map a string to an array
in thread Map a string to an array
Further to runrig's replies:
It's important to understand at each step how the structures of the hash and arrays are changing and evolving. Here's a kind of "running commentary" on that evolution, and a possible way to access and print what you want. Liberal use of data structure (for that's what you're dealing with; see perldsc) dump statements can be very enlightening about the changes that are going on. (And BTW, congratulations on being able to work with a system having at least 128 Terabytes of system RAM — or do I misinterpret the reference address of 0x7ffafc013bf8?)
>perl -wMstrict -MData::Dump -le "my %mapp; my @arr = qw(R T HH M); ;; $mapp{k} = \@arr; my @val = $mapp{k}; ;; dd \%mapp; dd \@val; ;; print join q{,}, @{$mapp{k}}; ;; push @val, 'RBB'; dd \@val; ;; $mapp{k} = \@val; dd \%mapp; ;; print join q{,}, @{$mapp{k}}; print join q{,}, @{ $mapp{k}->[0] }, $mapp{k}->[1]; " { k => ["R", "T", "HH", "M"] } [["R", "T", "HH", "M"]] R,T,HH,M [["R", "T", "HH", "M"], "RBB"] { k => [["R", "T", "HH", "M"], "RBB"] } ARRAY(0x1e14b3c),RBB R,T,HH,M,RBB
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Map a string to an array
by BrowserUk (Patriarch) on Nov 02, 2013 at 10:23 UTC |