in reply to Best way to make sure a number is an even multiple of another?

sub fix2 { my $n = shift; # must be greater or equal to this (assert >= 0) my $m = shift; # must be multiple of this (assert > 0) $n + ($m-$n)%$m; }

Caution: Contents may have been coded under pressure.
  • Comment on Re: Best way to make sure a number is an even multiple of another?
  • Download Code