#arithmetic.pm #!/usr/bin/perl -w use strict; package arithmetic; sub gcd() { my ($a, $b) = @_; ($a,$b) = ($b,$a) if $a > $b; while ($a) { ($a, $b) = ($b % $a, $a); } return $b; } sub lcm { my ($a,$b)=@_; return $a*$b/&gcd($a,$b); } ]