I linked to the documentation of the modulo operator. Your subroutine basically seems to do:
sub mod_9 { my( $x ) = @_; return $x % 9 }
Update: No, I misread the original function. You seem to input a number with decimals and want to know into which 9-tile it falls. int ($x*9)-1, as LanX notes below, is the correct answer then.
In reply to Re^3: sub as mathematical function
by Corion
in thread sub as mathematical function
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |