go ahead... be a heretic | |
PerlMonks |
Re: Check even numbers?by liverpole (Monsignor) |
on Aug 06, 2006 at 22:12 UTC ( [id://565872]=note: print w/replies, xml ) | Need Help?? |
A very simple method for checking whether a number $N is odd or even is to ask yourself "is there any remainder when I divide $N by 2?".
So, for example:
s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
In Section
Seekers of Perl Wisdom
|
|