SPUG: A hash of hashes and arrays

Duane Blanchard dblanchard at gmail.com
Mon Aug 1 08:46:16 PDT 2005


Hi all,

I have a hash of hashes and arrays. I'm able to print the all the keys
of the outer hash, and print the embedded hashes and arrays
individually, now I want to print the entire contents of the outer
(matrix) hash.

I need something like:

for each key in the outer hash
{   if (the key is a reference to a hash)
    {    print the contents of the hash;
    }
    elsif (the key is a reference to an array)
    {    print the contents of the array;
    }
}

I have everything in place, but don't know how to tell whether I'm
looking at a hash or an array.

Any hints?

P.S. In linguistics, we call the embedded sentences "embedded
sentences," clever, I know, and those into which they are embedded
"matrix sentences." What is the parlance in Perl/formal languages?

 
Duane Blanchard

There are 10 kinds of people in the world;
those who know binary and those who don't.


More information about the spug-list mailing list