>>>>> "JD" == Jatin Davey <jasho...@cisco.com> writes:

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

very good to see those.

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

  JD> my %months;
  JD> my $eng_ref;
  JD> my $fre_ref;

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

no need for that. you can assign the refs directly into the hash.

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

  JD> for (keys %months) {

that is assigning each key to $_. you never use $_. so this will loop
TWO times as there are two keys.

  JD> print "Months in english : @{$months{english}} \n";
  JD> print "Months in french : @{$months{french}} \n";

so both lines get printed twice.

what you want is more likely this:

        foreach my $month (keys %months) {

                print "Months in $month : @{$months{$month}}\n";
        }

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to