The code for tallying the bottom line (totals across departments) was similar, but not identical, to the code for tallying individual groups.
foreach my $period (@overall) { my %week = %{$period}; my ($sch, $occ, $percent); $sch = defined ($week{'sched'}) ? $week{'sched'} : 0; $occ = defined ($week{'occur'}) ? $week{'occur'} : 0; $percent = $sch ? $occ / $sch * 100 : 0;
Note the data structure: an array (@overall
) of hashes (%{$period}
) -- one level shallower than the preceding. But we still use the ternary operator three times.
Previous | Back to start of show | Next |
Slide: 5 mall_tally_bottom | © 2003 James E. Keenan |