Hi Monks, I've updated the code snippet so hopefully it's more clear. I'm stuck trying to dereference an array of hashes. Each key has 2 values (normally a hash consists of one key and one value...so this is confusing me a little bit.
For example, I have several managers (the key) that have 2 values for each ..."total events" and "total updates"
my @mans = qw / Joe Mike Rich /; my @tot_updates = qw /12 7 17 /; my @tot_events = qw /45 14 10 /; for (@mans) { push( @{$managers{$_}}, shift@tot_updates); push( @{$managers{$_}}, shift@tot_events); } for $t ( $#managers ) { for $b ( keys %{$managers[$t]}) { print "$t and $b is $managers[$t]{$b}\n"; } }
Pushing the values onto the array works fine i believe. It's dereferencing that's not working. I'm totally confused how to dereference this...I'd like the output to be: manager: value1(total updates) value2(total events) Joe 12 45 Mike 7 14 Rich 17 10 Please help if you can..I would really appreciate it greatly
In reply to Dereference an Array of Hashes by dirtdog
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |