#! /usr/bin/perl # varianz - Stichproben-Standardabweichung errechnen @SAVEDARGV = @ARGV; while(<>) { if(/(\d+) (\d+.*)/) { $count++; $xval = $1; $ysum += $2; if($count == 1) { $ymin = $2; } if($2 < $ymin) { $ymin = $2; } if($2 > $ymax) { $ymax = $2; } } } $ymittel = $ysum / $count; @ARGV = @SAVEDARGV; while(<>) { if(/(\d+) (\d+)/) { $sum+= ($2 - $ymittel) * ($2 - $ymittel) } } $varianz = $sum / ($count - 1); printf "%d %.2f %.2f %.2f %.2f\n", $xval, $ymittel, $ymin, $ymax, sqrt($varianz);