in reply to [ RESOLVED ] Please help me find my error.
Global symbol "%expenses" requires explicit package name at test.pl li +ne 13. Global symbol "%expenses" requires explicit package name at test.pl li +ne 15. Execution of test.pl aborted due to compilation errors.
Here is the modified code.
use strict; use warnings; my %v; $v{hourly_worker_expenses} = { # elaborate on this ! 'all' => 16 }; $v{hourly_worker_cost} = &{sub { my $cost = 0; my $item; my %expenses = %{$v{hourly_worker_expe +nses}}; # fixed typo $expensess foreach $item (keys %expenses) { $cost += $expenses{$item}; } return $cost; } }(); print $v{hourly_worker_cost};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Please help me find my error.
by Je55eah (Novice) on Jun 22, 2012 at 00:13 UTC |