#!/usr/bin/perl #Thanks to Mike Muuss for the math ;) $num=0; $tsumsq=0; $tsum=0; $ded=0; $thresmul=4.0; while(<>){ chomp; ($x, $y)=split; if($y ne "??"){ push @dat, [ $x, $y ]; $num++; $tsum+=$y; $tsumsq+=($y*$y); } else { push @dat, [ $x, $y ]; $ded++; } } $avg=$tsum / $num; $dev=sqrt($tsumsq / $num - $avg * $avg); $thresh= $dev * $thresmul; for($j=0; $j<($num+$ded); $j++){ if($dat[$j][1] ne "??"){ if(abs($dat[$j][1] - $avg) > $thresh){ $dat[$j][1]="??"; } } print $dat[$j][0], " ", $dat[$j][1], "\n"; }