Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

rot13 in Perl 6

View rot13
1 2 3 4 5 6 7 8 9 10 11
sub rot13($s) {
join "", map { chr(do given ord($_) {
when ord('A')..ord('Z') { ($_ - ord('A') + 13) % 26 + ord('A') }
when ord('a')..ord('z') { ($_ - ord('a') + 13) % 26 + ord('a') }
default { $_ } })
}, $s.comb
}
 
say(rot13($_)) for
q[V'ir zrnfherq vg sebz fvqr gb fvqr:],
q['Gvf guerr srrg ybat, naq gjb srrg jvqr.]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.