in reply to Re: sub as mathematical functionin thread sub as mathematical function
I linked to the documentation of the modulo operator. Your subroutine basically seems to do:
sub mod_9 { my( $x ) = @_; return $x % 9 } [download]
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.