http://www.perlmonks.org?node_id=11105615


in reply to Re^2: sub as mathematical function
in thread sub as mathematical function

>> min(int(9*$x),8)

When number of intervals vary (not only 9), then this looks more general:
my $intervals = 9; min( int( $intervals * $x ), $intervals - 1 )
or:
my $intervals = 9; int( $intervals * $x ) - int $x