use Statistics::Descriptive; $stat = Statistics::Descriptive::Full->new(); $stat->add_data(1.45,3.29,1.63,4.31,6.78,0.44,0.51,6.91,3.32,8.59,3.63,-5.30,0.61,6.31,0,7.83,-0.76,-3.33,4.24,6.90,2.40,6.27,2.01,1.56,0.45,3.86,-3.49,2.54,1.66,2.19,0.57,1.78,5.22,2.35,0.82,-0.49,1.59,-3.45,-3.27,-0.16,3.86,0.29,9.63,3.38,3.43,1.54,-0.61,-4.28,1.20,-2.94,2.90,6.17,0.35,2.20,7.31,11.63,6.83,-0.25,17.28,-4.45,5.01); %f = $stat->frequency_distribution(5); for (sort {$a <=> $b} keys %f) { print "key = $_, count = $f{$_}\n"; }