> -----Original Message-----
> From: Tyler Cruickshank [mailto:[EMAIL PROTECTED]]
> Sent: Friday, August 17, 2001 2:53 PM
> To: [EMAIL PROTECTED]
> Subject: Hi.
>
>
> 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";
You need to give more information. This code appears to run fine for me when
I supply some
values for @data. What is it printing? What do you expect it to be printing?
P.S. A more descriptive subject line is considered helpful as well.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]