For such a simple translation it might be overkill but you could also use an interpolation module such as Math::Interpolate for the translation.
use strict; use warnings; use Math::Interpolate qw(linear_interpolate); print "$_: ".linear_interpolate( $_, [0,255], [0,100])."\n" for 0..255 +;
In reply to Re: Normalizing a range of numbers to a percentage
by hdb
in thread Normalizing a range of numbers to a percentage
by stevieb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |