in reply to HASH HELP PLEASE

For the report, you need to read up on Perl formats. They'll help you produce exactly what you need. (If you have questions after you read this, I'll be happy to provide specific answers).

As far as how to store the information, I think you'd be better served by a Hash Of Hashes of Hashes, e.g. $idmatrix{$subname1}{$qName1}{$qName2}, or $idmatrix{Whoopie}{Cog}{Cogswell}.

That way, when it comes time to display your table you can just have a series of foreach my $name ( sorted keys %idmatrix } etc.

(The code snippets have not been tested, and random "s"s may have been added ot dropped; sorry.)

Replies are listed 'Best First'.
Re^2: HASH HELP PLEASE
by Anonymous Monk on Jun 01, 2008 at 16:19 UTC
    Looks like a way to go... can be more specific,I am new to hashes. Since I could'nt deal with this woth 2D arrys,turned on to hashes. How do I assign values:to hash of hash of hash and how the hell i print it? Looks like they are not in the order.... please help me.

      Hashes are, by definition, unordered (or rather, not in an order you would think of :). If you need them sorted, then see the keys() and sort() functions.

      You may want to also search for HoHoH

      --MidLifeXis

      You can think of a hash as being like an array, only using a unique string as a key rather than a unique number as an index. (push adds an element at the end of an array, so you never need to know the index. With a hash, you have to explicitly specify what the key is, as in for example, "Sample 17".)

      Take a minute and read the Data Type: Hash tutorials. Again, if you have explicit questions, don't hesitate to ask.

      Have a read of the PDSC (Perl Data Structures Cookbook).