The Bull Og

Onine since 1994. Offline since 1976.

See also the archive

An individual post follows.

What a headache Perl de-referencing can be, which I had forgotten ('cause it's been a while since I've worked with such nested data structures.)

I had this variable:

$obj->{'children'} me some big data structure of a hierarchy of the object's children. When I dumped the variable to STDERR, I could tell that there was an 'id' associative index in there somewhere.

After a great deal of trial-and-error, I finally came up with this in order to dereference the referenced arrays in $obj->{'children'} and then get the "id" value of the referenced hash. Say that fives times fast.

foreach my $child ($obj->{'children'}) {
           print STDERR @$child[1]->{'id'}."\n";