#!/usr/bin/perl $c = 50; $r = 20; $total = $max = 0; while (<>) { $h = ++$hist[int($_ * $c / 2**20)]; $max = $h if ($h > $max); $total++; } printf "%.2f%%\n", $max * 100 / $total; for ($i = $r - 1; $i >= 0; $i--) { for ($j = 0; $j < $c; $j++) { $v = $hist[$j] * $r / $max; if ($v >= $i + 0.5) { print "O"; } elsif ($v > $i) { print "o"; } else { print " "; } } print "\n"; }