Jdavis wrote:

> 
> I have a hash that i needed to put into a 2d array.
> I wound up doing this...
> 
> foreach $key (keys(%temp)){
>         push(@graph_key,$key);
>         push(@graph_value,$temp{$key});
> }
> 
> $data[0] = [EMAIL PROTECTED];
> $data[1] = [EMAIL PROTECTED];
> 
> Though Im not quite sure why i need to escape the @?
> 
> but it works :)

Well, you aren't 'escaping' the @ in the array name. 

You're taking a reference to the original array itself 

if you print $data[0] you'll see that it's an array reference, and needs to 
be accessed via @{ $data[0] }.

I'm not sure this is the best way of doing this, in this case... THe only 
reason I can think of to use arrays in this manner is because you need the 
data in a particular order. 

What's wrong with using the hash itself to store the data? Maybe I need to 
back up and look at the original post again. *headscratching*


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

Reply via email to