>>>>> "JLP" == Jamie L Penman-Smithson <[email protected]> writes:

  JLP> 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? 

  JLP> Use the modulo operator:

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

  JLP> if ($a % $b == 0) {

no need for the == 0 if you invert the test with unless or change the
print text.

  JLP>     print "$b is divisible by $a\n";
  JLP> }

uri

-- 
Uri Guttman  ------  [email protected]  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to