http://www.perlmonks.org?node_id=977730


in reply to [ RESOLVED ] Please help me find my error.

foreach $item ($costs)
You probably mean foreach $item (keys %costs). Note the use of the keys keywords so that you only loop over the keys of %costs, so that you can then do $cost += $costs{$item};

You wrote $costs, you probably meant %costs.


my %costs = $v{hourly_worker_expenses};
This also probably isn't what you meant, because earlier you assigned a hashref to that slot. And hashrefs need to be dereferenced. The line should probably read my %costs = %{$v{hourly_worker_expenses}};

HTH.