-
Each treatment group has a unique ID (
$_ below).
-
Each group meets weekly unless excused. A group either occurs or fails to occur.
-
Tallying is done in multi-week periods (typically, a month).
foreach my $period (@overall) {
my %week = %{$period};
foreach (keys %week) {
my ($sch, $occ, $percent);
$sch = defined ($week{$_}{'sched'}) ? $week{$_}{'sched'} : 0;
$occ = defined ($week{$_}{'occur'}) ? $week{$_}{'occur'} : 0;
$percent = $sch ? $occ / $sch * 100 : 0;
-
This is part of the code to compute each row in the preceding slide.
-
Note the data structure: an array (
@overall) of hashes (%{$period}) of hashes (%{$week{$_}}). Note also the 3 uses of the ternary operator.
| Slide:
4
mall_tally_2
|
© 2003 James E. Keenan |