open (FH, '>', "junk") or die $!; $en_text = $obj->translate( 'source' => 'English', 'destination' => 'Spanish', 'text' => "i am mexican with black hair and brown eyes", 'delimiter' => "\n\n", 'ofh' => \*FH); #### #!/usr/bin/perl use strict; use warnings; use WWW::Babelfish; use Data::Dumper; # open (FH, '>', "junk") or die $!; my $obj = new WWW::Babelfish( service => 'Google', agent => 'Mozilla/8.0'); die( "Babelfish server unavailable\n" ) unless defined($obj); my @sentences = ("I would like to translate this sentence into Spanish", "Because i am mexican with black hair and brown eyes"); my @translations = (); for (@sentences) { my $en_text = $obj->translate( 'source' => 'English', 'destination' => 'Spanish', 'text' => $_, 'delimiter' => "\n\n"); die("Could not translate: " . $obj->error) unless defined($en_text); push(@translations,$en_text); } print Dumper (@translations); #### $VAR1 = "Quisiera traducir esta oraci\x{f3}n a espa\x{f1}ol"; $VAR2 = 'Porque soy mejicano con el pelo negro y los ojos marrones';