in reply to Adding command line arguments.
though, i could be totally wrong...foreach(@ARGV) { if (int($_/2) == ($_/2)) { print "$_\n"); } }
Also, look into the possibility that Perl has a "mod" operator.. i don't know offhand, but most other languages do.
it works like $remainder = mod($number, $divisor), wherein $remainder ends up with the leftover (remainder) from $number/$divisor.
so, if you had mod(6, 2) the remainder would be 0, but for mod(6, 4) the remainder would be 2
i'm not all that familiar with Perl, but there must be some similar functionality....
anyhow, good luck!
|
---|