use strict; use warnings; use Data::Dumper; use v5.10; use Encode qw(encode decode encode_utf8); use WWW::Dict::Leo::Org; my $leo = WWW::Dict::Leo::Org->new( -Debug => 0 ); open( my $fh, ">:utf8", "leo-translate.txt" ); my $string = 'strasse'; #$string = encode_utf8 ($string); #$string = decode('utf8', $string); #$string = encode('utf8', $string); foreach my $match ( $leo->translate($string) ) { say {$fh} $match->{'title'}; foreach my $value ( @{ $match->{'data'} } ) { my $string1 = decode('utf8', $value->{'left'} ); my $string2 = decode('utf8', $value->{'right'} ); my $string = join("\t", $value->{'left'}, $value->{'right'} ); printf {$fh} ("%-50s%-50s\n", $string1, $string2); } }