Skip to content

Instantly share code, notes, and snippets.

@lestrrat
Created April 28, 2009 08:24
Show Gist options
  • Save lestrrat/103024 to your computer and use it in GitHub Desktop.
Save lestrrat/103024 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/perl
my $codec = [
[ qw(あ い う え お) ],
[ qw(か き く け こ) ],
[ qw(さ し す せ そ) ],
[ qw(た ち つ て と) ],
[ qw(な に ぬ ね の) ],
[ qw(は ひ ふ へ ほ) ],
[ qw(ま み む め も) ],
[ 'や', undef, 'ゆ', undef, 'よ' ],
[ qw(ら り る れ ろ) ],
[ 'わ', undef, 'を', undef, 'ん' ],
];
my $ret = '';
foreach my $point (split(/\//, $ARGV[0])) {
if ($point =~ /(\d)(\d)(\d)(\d)/) {
$ret .= $codec->[ $1 * $2 ]->[ $3 * $4 ];
}
}
print $ret, "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment