timestamps is a hash containing at least one element that is an array reference. The array reference contains 5 elements containing array references. That is a horrible way to describe the structure so lets look at some code ways of dealing with it
use strict; use warnings; my %timestamps = ( x => [ ['2013-08-18T20:43:40Z'], ['2013-08-18T20:43:12Z'], ] ); my $page = 'x'; my @edits = @{$timestamps{$page}}; for my $stamps (@edits) { for my $stamp (@$stamps) { print "a: $stamp\n"; } } print "b: $edits[0][0]\n"; print "b: $edits[1][0]\n"; print "c: $timestamps{x}[0][0]\n"; print "c: $timestamps{x}[1][0]\n";
Prints:
a: 2013-08-18T20:43:40Z a: 2013-08-18T20:43:12Z b: 2013-08-18T20:43:40Z b: 2013-08-18T20:43:12Z c: 2013-08-18T20:43:40Z c: 2013-08-18T20:43:12Z
I've only populated two of the time stamps, but that should serve to see how things hand together. Note the {} to access the hash elements and the [] to access the array elements, and that you can concatenate them as you like for whatever structure you have.
In reply to Re: dereference array
by GrandFather
in thread dereference array
by natxo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |