Gossamer Forum
Home : Products : Links 2.0 : Customization :

Real simple question about math functions

Quote Reply
Real simple question about math functions
Hello all!

Yes its me again! Smile

What funtion in Perl determines if a variable is divisible by a specified interger?
Example: I need blue!
if ($i is divisible by 2 == 0) {
$x = 1;}
else { $x = 0; }


-or-

What funtion gets the remander from division. I could be mistaken, but as I recall from when I studied C ++ a hundred years ago that the "%" was used. 5%2=1 4%2=0

Example: I need green!
if ($i % 2 == 0) {
$x = 1;}
else { $x = 0; }


Thanks,

beetleman
beetlemanTongue

Marcus L. Griswold
Subject Author Views Date
Thread Real simple question about math functions beetleman 1342 Nov 5, 2001, 12:36 AM
Thread Re: [beetleman] Real simple question about math functions
beetleman 1322 Nov 5, 2001, 2:35 AM
Thread Re: [beetleman] Real simple question about math functions
Paul 1319 Nov 5, 2001, 4:08 AM
Thread Re: [RedRum] Real simple question about math functions
sponge 1296 Nov 5, 2001, 10:06 AM
Post Re: [PerlFreak] Real simple question about math functions
Paul 1318 Nov 5, 2001, 10:38 AM