in reply to Hash in Perl

Thank you to all well explanation to all.. one more problem i have Thank you well explanation.
my%hash = (Script => "Perl", script_1=>"Ruby", script_2=> "PHP"); for my$k (keys %{my$href}) { print "$k => ${$href}{$k}\n"; }
it showing Global symbol $href requires explicit package name.why this error.?

Replies are listed 'Best First'.
Re^2: Hash in Perl
by Lennotoecom (Pilgrim) on Jan 02, 2014 at 07:20 UTC
    because $href you're using is not defined
    at least in this snippet
    for my $k (keys %hash) { print "$k => $hash{$k}\n"; }
      Ya but in perldoc showing like
      for my $key (keys %{$href}) { print "$key => ${$href}{$key}\n";
      this also please see and tell me http://perldoc.perl.org/perlreftut.html
        my %hash = (Script => "Perl", script_1=>"Ruby", script_2=> "PHP"); $href = \%hash; for my $k (keys %{$href}) { print "$k => ${$href}{$k}\n"; }