$quality = ';;;;;;;;;;;9;7;;.7;393333';
$avg = avgqual($quality);
print "$quality
$avg
";

sub avgqual {
	my $string = shift;
	my $sum;
	for ($i=0; $i<length($string); $i++) {
		$q = substr($string, $i, 1);

		$sum+=ord($q) - 33;
	}
	return $sum/length($string);
}