$total = 0; $count = 0; for ($j = 2; $j < @tableb; $j++) { chomp ($tableb[$j]); ($netsta,$delay_time) = (split /\s+/,$tableb[$j])[1,9]; ($net,$sta) = (split /\./, $netsta)[0,1]; if ($net eq "ZJ") { $count = $count + 1; $total = $total + $delay_time; $mean = $total/$count; print $mean, "\n"; } #### -0.9188 -1.0063 -0.585466666666667 -0.705775 -0.80838 -0.80595 -0.722071428571429 -0.6714 -0.773888888888889 -0.84067 -0.9097 -0.958375 -0.7386 -0.7877 -0.784433333333333 -0.69155 -0.78836 -0.779766666666667 -0.820314285714286 -0.8476 -0.802544444444444 -0.88008 -0.9104 -0.916916666666666 -0.962815384615385 -1.0093