Skip to content

Instantly share code, notes, and snippets.

@EricCrosson
Last active December 15, 2015 14:29
Show Gist options
  • Save EricCrosson/f451bbb891572c5fba8e to your computer and use it in GitHub Desktop.
Save EricCrosson/f451bbb891572c5fba8e to your computer and use it in GitHub Desktop.
A perl script to find the greatest common denominator of two integers.
sub gcd {
my ($m, $n) = @_;
until ($n == 0) {
($m, $n) = ($n, $m % $n);
}
return $m;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment