Without taking anything away from what the last poster said, though use strict and use warnings are not commandment cut in stones, however, (they) will help point out errors in codes!

You could use Data::Dumper or Data::Dump to print your data structure, like this:

use warnings; use strict; use Data::Dump qw(dump); use Data::Dumper; my @mans = qw / Joe Mike Rich /; my @tot_updates = qw /12 7 17 /; my @tot_events = qw /45 14 10 /; my %managers; for (@mans) { push( @{$managers{$_}}, shift@tot_updates); push( @{$managers{$_}}, shift@tot_events); } dump(\%managers); print Dumper(\%managers);

Dump Output:

{ Joe => [12, 45], Mike => [7, 14], Rich => [17, 10]}

Dumper Output:
$VAR1 = { 'Joe' => [ '12', '45' ], 'Rich' => [ '17', '10' ], 'Mike' => [ '7', '14' ] };

And if you don't like the printed display, atleast you have an idea of what to parse. It really a good way to cheat parsing data structure in Perl

You could also check perldoc perldsc a good Perl Data Structure Cookbook tutorial


In reply to Re: Dereference an Array of Hashes by 2teez
in thread Dereference an Array of Hashes by dirtdog

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.