my %hash; open(ANSWERTALLY, "answertally.dat"); while() { next unless /^Running totals:/ .. /^Averages:/; next if /^Running totals:/; last if /^Averages:/; my ($key, $value) = split(/\s=\s/); chomp($value); $hash{$key} = $value; } close(ANSWERTALLY);