Instead it returns nothing.If you use strict and warnings you will get something -- an error message.
wfsp is correct. Dumpvalue may also be useful when you're trying to remember how to dereference because it shows the numeric indexes of arrays (How can I visualize my complex data structure?):
use warnings; use strict; use Dumpvalue; my $res1 = { 'report' => [ '2011-01-25 10:30:50', { 'AntiVir' => 'Eicar-Test-Signature' } ] }; Dumpvalue->new->dumpValue($res1); __END__ 'report' => ARRAY(0x60b0f0) 0 '2011-01-25 10:30:50' 1 HASH(0x60b220) 'AntiVir' => 'Eicar-Test-Signature'
An alternate approach is to use Data::Diver:
use warnings; use strict; use Data::Diver qw(Dive); my $res1 = { 'report' => [ '2011-01-25 10:30:50', { 'AntiVir' => 'Eicar-Test-Signature' } ] }; print Dive( $res1, qw( report 0 ) ), "\n"; print Dive( $res1, qw( report 1 AntiVir ) ), "\n"; __END__ 2011-01-25 10:30:50 Eicar-Test-Signature
In reply to Re: Pulling a hash value in a data structure
by toolic
in thread Pulling a hash value in a data structure
by Freethinker0
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |