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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.