Re: Printing hash of hashes in table format



Deepu wrote:
Hi All,

I am trying to print hash of hashes in table format on to the screen or
to a file. But am not able to get how this can be achieved. Can
somebody please help me on this.

Now i am printing a hash of hashes using:

while (($key, $value) = each %hash) {
print ("%-20s => %d\n", $key, $value);
}

The keys and values is actually:

"TEST1-TEST2" => '2'
"TEST2-TEST3" => '3'
"TEST1-TEST3" => '1'
"TEST2-TEST1" => '0'

I need to put the key and values in atable format like:

STATES TEST1 TEST2 TEST3

TEST1 2 1 3

TEST2 1 0 0

TEST3 4 6 3


Perhaps you could explain the relationship
between the data in your hash above and
the data in your table above. I don't see any.

I could guess that you mean this:

STATES TEST1 TEST2 TEST3

TEST1 - 2 1

TEST2 0 - 3

TEST3 - - -

but I'm not sure.

--
Brad

.