in reply to Iterating over hash elements (was: Sorry to bother you)

After perusing through the perldsc, you might come up with something like the following code (untested):
my $johndoe_hours = 0; foreach my $month ( keys %main } { $johndoe_hours += $johndoe_hours + $main{$month}{johndoe}; }

my $johndoe_hours = 0; foreach my $month ( keys %main } { $johndoe_hours += $main{$month}{johndoe}; }
If you want to get rid of the error message when {johndoe} does not exist in the hash $main{$month} (that is assuming you are using warnings), you might want to do something like the following instead:
my $johndoe_hours = 0; foreach my $month ( keys %main } { if ( exists $main{$month}{johndoe} ) { $johndoe_hours += $johndoe_hours + $main{$month}{johndoe}; } }

my $johndoe_hours = 0; foreach my $month ( keys %main } { if ( exists $main{$month}{johndoe} ) { $johndoe_hours += $main{$month}{johndoe}; } }
update: Fixed code from doubling johndoe's hours.

-enlil