#!/usr/bin/perl -w use strict; my ($total, $count) = (0, 0); while (<>) { s/\s+//g; $total += $_; ++$count; } print $total / $count, "\n";