in reply to JSON Structure Question
Untested, but I'd try something like:
for my $key (sort keys %$data) { # $key should be 1, 2, then 3 here... for my $subject (sort keys {$data->{$key}) { # $subject should be subject1, then subject 2 here if ($subject eq "subject1") { print "$data->{$key}{$subject}\n"; } elsif ($subject eq "subject2" { # subject2 has arrayref of one item, # an href, with two keys: print "$data->{$key}{$subject}[0]{subject3}\n"; print "$data->{$key}{$subject}[0]{subject4}\n"; } } }
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: JSON Structure Question
by omegaweaponZ (Beadle) on May 23, 2013 at 15:36 UTC | |
by omegaweaponZ (Beadle) on May 23, 2013 at 18:58 UTC |
In Section
Seekers of Perl Wisdom