|
Posted by Tad J McClellan on February 24, 2008, 9:40 am
Please log in for more thread options
> Hi everybody,
>
> I can't make sense of my little perl script ; I've no idea where the
> probleme is... could you give me a way to understand...
>
> I've this short code :
> use strict;
> use Data::Dumper;
> use Lingua::Identify qw/:language_identification/;
>
> my %probabilities;
> my %languages = langof_file("test.txt");
>
> print Dumper(%languages);
>
> it print the text in the console :
> $VAR1 = 'pt';
> $VAR2 = '0.0299573389196567';
> $VAR3 = 'tr';
> $VAR4 = '0.0152319153730931';
> $VAR5 = 'da';
> $VAR6 = '0.0359140188331814';
> .../...
>
>
> But, I want an output like this one :
>
> $VAR1 = {
> 'pt' => '0.0299573389196567',
> 'tr' => '0.0152319153730931',
> 'es' => '0.0403864688211945',
> 'da' => '0.0359140188331814',
> };
>
> What's wrong ?
Pass Dumper() a reference rather than a list of keys and values:
print Dumper \%languages;
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher0cmdat/"
|