in reply to not loading all test data

Because you're both shifting and counting

Try this:

open SCORES, "a:/scores.txt" or die "Error: $! while opening scores fi +le\n"; my $students = 0; my $totalscore = 0; while (<SCORES>) { chomp; my @line = split /:/; while (@line) { my $student = shift @line; my $score = shift @line; print "$student\n$score\n"; $students++; $totalscore += $score; } } print "average: ", $totalscore/$students, "\n" if $students;

Update: fixed embarrassing typos and minor errors