Hi,

I entered a question before, but am still stumped. I reduced what I think may be the source of my uncertainty to the following.
#!/usr/bin/perl use strict; use Data::Dumper; use regression; open (TEST,">xxx.txt"); my %test = (); my @teams = ('packers','lions','bears','vikings'); my @data = (5,10,15,20); my $counter = 1; foreach my $team (@teams) { my $counter2 = 0; foreach my $data_value (@data) { $test{$team}{'raw_data'}{$counter} = $data_value; print TEST "$team: $counter - $test{$team}{'raw_data'}{$counte +r}\n"; $data[$counter2] = $data[$counter2] * 2; $counter2++; $counter++; } } close (TEST);
Question 1:
Did the above create four hash data structures with the following key, value pairs?

Hash 1
1 -> 5,
2 -> 10,
3 -> 15,
4 ->20

Hash 2
5 -> 10,
6 -> 20,
7 -> 30,
8 -> 40

Hash 3
9 -> 20,
10 -> 40,
11 -> 60,
12 -> 80

Hash 4
13 -> 40,
14 -> 80,
15 -> 120,
16 -> 160

Question 2:
How do I print out each of these four hashes?

It’s a bit of a mimic of something for work. I need to pass what is for me a complicated hash into a small perl mod I made.

Tony

In reply to difficulty with complicated (for me) hashes by o2bwise

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.