You want to produce a linear function mapping the minimum value in a list to 1 and the maximum in the list to 3. List::Util provides min() and max() functions. The coefficient of the linear term will be $m = (3 - 1)/(max(@list)-min(@list)), and the constant term will be $c = 1 - $m * min(@list). The map builtin will be handy to then apply that to the file data in @list.
After Compline,
Zaxo
In reply to Re: number normalization
by Zaxo
in thread number normalization
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |