Skip to content

Instantly share code, notes, and snippets.

@kidd
Created December 10, 2009 11:17
Show Gist options
  • Save kidd/253280 to your computer and use it in GitHub Desktop.
Save kidd/253280 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
binmode STDOUT, ":utf8";
use Encode;
my @rev = split '' ,decode_utf8(q|zʎxʍʌnʇsɹbdouɯןʞɾıɥƃɟǝpɔqɐ()'{}|);
my @norm = split '', 'zyxwvutsrqponmlkjihgfedcba)(,}{';
my %h = map {$norm[$_] => $rev[$_]} 0..$#rev;
local $/=undef; #slurp the whole stdin. you have to quit with ctrl-d or ctrl-c
$_ = <STDIN>;
s/(.)/$h{$1} ? $h{$1} : $1/gex;
print scalar reverse "\n", decode_utf8($_) ,"\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment