#!perl -w use strict; use Jcode; my $DEBUG = 1; my $text = ''; for(<>) { if($DEBUG) { my ($code) = getcode($_); print "Chunk encoded as: " . $code . "\n"; } my $j = Jcode->new($_); $text .= $j->utf8 . "\n"; } print "\nText to send:\n" . $text . "\n" if $DEBUG; print "\nConnecting to translator... please wait.\n\n"; use WWW::Babelfish; my $obj = new WWW::Babelfish(); die( "Babelfish server unavailable\n" ) unless defined($obj); print "\nTranslating... this may take a loooong time.\n\n"; my $english = $obj->translate( source => 'Japanese', destination => 'English', text => $text, delimiter => '\n', ); print "\nTranslation: \n\n"; print $english; print "\n";