in reply to Re^2: sub as mathematical function

in 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 }

**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 Section
Seekers of Perl Wisdom

Comment onRe^3: sub as mathematical functionSelectorDownloadCode