Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Modulo operation to return quotient and remainder

by dasgar (Priest)
on Jul 11, 2012 at 19:56 UTC ( [id://981243]=note: print w/replies, xml ) Need Help??


in reply to Modulo operation to return quotient and remainder

As pointed out, it's not difficult to do it with just a few lines of code. If you wanted to, you could also just create a subroutine like the untested code below:

use strict; use warnings; sub modulo { my $number = shift; my $divisor = shift; my $remainder = $number % $divisor; my $quotient = ($number - $remainder) / $divisor; return ($remainder, $quotient); }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://981243]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-19 06:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found