On Sat, 2010-05-01 at 07:15 -0400, Paul wrote:
> Hello all.  How can I test to see if a number is divisible by say, 40? 

Use the modulo operator:

my $a = 40;
my $b = 1;

if ($a % $b == 0) {
    print "$b is divisible by $a\n";
}

-j


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to