Hi

I am a newbie to Perl , I have this piece of code :

*CODE:*

#!/usr/bin/perl
use warnings;
use strict;

my @english = qw(january february march april may june july);
my @french = qw(janvier fverier mars avril mai juin juily);

my %months;
my $eng_ref;
my $fre_ref;

$eng_ref = \...@english;
$fre_ref = \...@french;

$months{english} = $eng_ref;
$months{french} = $fre_ref;

for (keys %months) {
print "Months in english : @{$months{english}} \n";
print "Months in french : @{$months{french}} \n";
}


*OUTPUT:*

Months in english : january february march april may june july
Months in french : janvier fverier mars avril mai juin juily
Months in english : january february march april may june july
Months in french : janvier fverier mars avril mai juin juily


*Question*

Why do i get the array that i wanted two times ?
i have just added two keys into the hash then why do i get the values two times.

Please explain me this.

Thanks
Jatin

Reply via email to