The | A general answer to the question "How can I get X?" from a complex data structure is to start from the top level and work downwards. The process may be a bit tedious, but will usually bear fruit.
Consider:
The top levelc:\@Work\Perl\monks>perl -wMstrict -MData::Dump -e "my ($a, $b, $c, $d) = ('a' .. 'd'); ;; my %obiekt; ;; push @{$obiekt{$a}{$b}}, [$c,$d]; dd \%obiekt; print qq{\n}; ;; dd $obiekt{$a}; print qq{$obiekt{$a} \n\n}; ;; dd $obiekt{$a}{$b}; print qq{$obiekt{$a}{$b} \n\n}; ;; dd $obiekt{$a}{$b}[0]; print qq{$obiekt{$a}{$b}[0] \n\n}; ;; print qq{>$obiekt{$a}{$b}[0][0]< >$obiekt{$a}{$b}[0][1]<}; " { a => { b => [["c", "d"]] } } { b => [["c", "d"]] } HASH(0x216fa0) [["c", "d"]] ARRAY(0x216fdc) ["c", "d"] ARRAY(0x21700c) >c< >d<
Going down a level to
dd $obiekt{$a};
print qq{$obiekt{$a} \n\n};
yields
{ b => [["c", "d"]] }
HASH(0x216fa0)
and tells you that the value of the $obiekt{$a} key of the hash is yet another hash reference. print-ing this reference simply stringizes the reference into a standard format that tells you that a reference is present and the type of the reference; it's not useful for much else.
Another level down, and
dd $obiekt{$a}{$b};
print qq{$obiekt{$a}{$b} \n\n};
produces
[["c", "d"]]
ARRAY(0x216fdc)
which tells you that you now have a reference to an array containing a single item: another array reference.
Yet another level down, and
dd $obiekt{$a}{$b}[0];
print qq{$obiekt{$a}{$b}[0] \n\n};
outputs
["c", "d"]
ARRAY(0x21700c)
which is the value of the lowest level array reference.
Finally,
print qq{>$obiekt{$a}{$b}[0][0]< >$obiekt{$a}{$b}[0][1]<};
accesses the content of the lowest level array reference and gives you
>c< >d<
Standard Disclaimer Concerning $a And $b Special Variables: These variable names are used for Perl special package variables (see General Variables section of perlvar) that are associated with the sort built-in and its ilk. These names should generally be avoided in your code, even brief example code such as in the OP, and especially when used as the name of a lexical. Severe foot distress may result otherwise.
Give a man a fish: <%-{-{-{-<
In reply to Re: references, dreferences
by AnomalousMonk
in thread references, dreferences
by michal_p
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |