Why doesn't this work?
#!/usr/bin/perl5 -w ########################################################## %fred = (1 => "un", 2 => "deux", 3 => "trois"); %mary = (1 => "eins", 2 => "zwei", 3 => "drei"); print "\nfred:"; for (keys %fred) {printf "\t%3s: %-8s", $_, $fred{$_}}; print "\nmary:"; for (keys %mary) {printf "\t%3s: %-8s", $_, $mary{$_}}; print "\n"; @nm = qw(fred mary); for $n (@nm) {print "\n$n:"; for (keys %{$n}){printf "\t%3s: %-8s", $_, ${$n}{$_}}} my %fred1 = (1 => "yksi", 2 => "kaksi", 3 => "kolme"); my %mary1 = (1 => "uno", 2 => "due", 3 => "tre"); use strict; my @nm1 = qw(fred1 mary1); print "\n"; for my $n (@nm1) { print "\n$n:"; for my $m (keys %{$n}) { printf "\t%3s: %-8s", $m, ${$n}{$m}; } } print "\n"; __END__ (svmoloch:szhxrv) $ ./test_hashname.pl fred: 1: un 2: deux 3: trois mary: 1: eins 2: zwei 3: drei fred: 1: un 2: deux 3: trois mary: 1: eins 2: zwei 3: drei Can't use string ("fred1") as a HASH ref while "strict refs" in use at + ./test_hashname.pl line 27. fred1:

In reply to string as a HASH ref by GreyOwl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.