multidimentional hash that has both two and three keys

From: Trina Espinoza (trinasofia_at_hotmail.com)
Date: 01/30/04


To: beginners@perl.org
Date: Thu, 29 Jan 2004 22:34:46 -0800

Can you have a multidimentional hash that has both two and three keys?

For example:

Array with two keys and a value:
$HASH-> {$VAR}{letter} ="a";

Same Array with three keys and a value:
$HASH->{$VAR}{$number){float} = "1.1";
$HASH->{$VAR} {$number}{integer}="2";

Is this possible? I'm not sure if it didn't wok b/c of an error in syntax or
if it's because it's not possible.

To print the two keys and value I know I do:

print $HASH->{$VAR}{letter};

BUT, if I have three keys and a value, how do I print it? If $number is a
different number every time (1 ..10), how do I get it to print so that it
iterates through each number and gives me the float and the integer for
each.

Hope this makes sense! Any examples would help get me started

Thanx!

_________________________________________________________________
High-speed users—be more efficient online with the new MSN Premium Internet
Software. http://join.msn.com/?pgmarket=en-us&page=byoa/prem&ST=1



Relevant Pages

  • Re: comparing some but not all fields in lists
    ... and what's in common." ... I should compare only 3 of the 82 fields in each list. ... comparing all 82 fields as a single array element. ... cannot handle multiple keys as you want it to. ...
    (perl.beginners)
  • Re: Build an array from a text file
    ... Now that I have created my array, ... The dictionary object has a 'keys' method that returns a 0 based array ... Dim vArray As Variant ... dictionaries, so any help would be great! ...
    (microsoft.public.word.vba.general)
  • Re: Nugget - Using control references
    ... until someone decides they want to save a 3D array. ... If the users are likely to add elements to the middle of the enum, you should save and load by the enum text. ... What you can try is this - save both the string and the number. ... Unused keys are not deleted.  When the number of elements in an array is reduced, the key entries still exist in the file. ...
    (comp.lang.labview)
  • Re: hash sortieren nach werten, hash in =?ISO-8859-15?Q?popupmen?= =?ISO-8859-15?Q?=
    ... Dieses Array gibst Du bei -values an. ... Du schreibst Dir eine Funktion, die Dir die Keys ... des Hashes in der Sortierung der Werte liefert. ... values ist eine Referenz auf ein @rray, ...
    (de.comp.lang.perl.cgi)
  • Re: populating a hash with % used as the key and F string as the value
    ... > keys %lookup; ... it states one cannot push or pop a hash on page 10 ... itself is the reference to the array (read: an arrayref). ...
    (perl.beginners)