As moritz already pointed out, this just relies on the way that the incrementer works on characters. Your code can be reduced a little further by using the preincrementor within the map, although it won't solve the problem with 'z' becoming 'aa'. But tighter still would be to just use a for:
#!/usr/bin/perl use 5.12.0; my @rot = qw(a v c g h t); $_++ for @rot; say @rot;
- Miller
In reply to Re: Rot13 encryption
by wind
in thread Rot13 encryption
by cyber-guard
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |