sub get_bin { # Determine the name of the bin to put the value into my $val = shift; my $bin_min = 10*int($val / 10); my $bin_max = $bin_min + 10; return "$bin_min-$bin_max"; }