Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ronaldxs/74b7450aeccb48985fdede871f53d364 to your computer and use it in GitHub Desktop.
Save ronaldxs/74b7450aeccb48985fdede871f53d364 to your computer and use it in GitHub Desktop.
# Perl 6 version that runs faster than Perl 5 equivalent
my int ($a, $one, $three, $limit) = (42, 1, 3, 10000000);
loop (my int $i = 0; $i < $limit; $i++) {
$a += $one + $a%$three
}
say $a
# Perl 5 equivalent
my $a = 42;
for (my $i = 0; $i < 10000000; $i++) {
$a += 1 + $a%3
}
print $a, "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment