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]}
$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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |