>>> "Tyler Cruickshank" <[EMAIL PROTECTED]> 08/17/01 12:53PM >>>
Hi.

I am working with a hash of arrays.  Ive run into some confusion regarding the 
accessing and printing of the hash.  Below are some excerpts of my code:  I have an 
array (@data) that I will create in a nested for loop.  I fully populate the array and 
then assign it to a hash, I then go back and populate a fresh array and then assign it 
to the hash.   Each fresh array will be called the same name, @data, however it is 
assigned to the hash via a unique key (which in this case is $name).  Now, when I want 
to print the hash (as below) the following works - print " $name = @{ $browns{$name} 
}\n"; but I have found (in other code) that - print " $name = @{ $browns{'data.hr3'} 
}\n"; works inconsistently.  What is the proper way to do this - especially if I want 
a specific array within the hash?

%browns = ();

for($i=1; $i<=3; $i++){

   $hour = "hr$i";
   $root = 'data.';
   $name = "$root$hour";

   $browns{$name} = [ @data ];
   }


print "   $browns{$name}[1]   \n";
print " $name = @{ $browns{'data.hr3'} }\n"; 
print " $name = @{ $browns{$name} }\n";


Thanks.  - Tyler Cruickshank



--
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to