in reply to Re: Re: Hash Problems
in thread Hash Problems

Where do you insert the 'Name' key? It is the Array. It is an other Value than the other keys.

Replies are listed 'Best First'.
Re: Re: Re: Re: Hash Problems
by Anonymous Monk on May 17, 2001 at 00:29 UTC
    Use curlys {} not [] . And you will have Name as Hash. I think from your code you want it as Hash, because as now the =>"" makes no Sense.
Re: Re: Re: Re: Hash Problems
by wstarrs (Acolyte) on May 17, 2001 at 00:21 UTC
    Ok, so I figured out this part, but now my problem is that I need to have the hash set up so that I have a many keys (file names) and each key has multiple values (parsed from the files) these bascially need to be set up like this:
    %pers_dcr_files = ( 'Name' => [ 'RightNavLaunchDate' => "", 'RightNavExpirationDate' => "", 'LinkURL' => "", 'SmallGraphic' => "", 'ShowHome' => "", 'ShowPersonal' => "", ] ); # Hash for Business Page %bus_dcr_files = ( 'Name' => [ 'RightNavLaunchDate' => "", 'RightNavExpirationDate' => "", 'LinkURL' => "", 'SmallGraphic' => "", 'ShowHome' => "", 'ShowBusiness' => "", ] ); # Hash for Home Page %home_dcr_files = ( 'Name' => [ 'RightNavLaunchDate' => "", 'RightNavExpirationDate' => "", 'LinkURL' => "", 'SmallGraphic' => "", 'ShowHome' => "", 'ShowBusiness' => "", 'ShowPersonal' => "", ]
    I had these initial settings in my code, that is what was causing the array/hash error, but how do I set up my hashes in this manner to proceed with my program and not break the logic from the previous part?
      I don't think that you are gaining anything by setting up these initial values for the hashes. You should be able to just comment out those three assignments and have everything work.
        Yeah, I did that and it seems to work fine, one final question on this subject, the data output looks like this:
        $VAR5 = 'Test2'; $VAR6 = { 'ShowHome' => 'Home', 'RightNavExpirationDate' => 20010520, 'RightNavLaunchDate' => 20010510, 'ShowPersonal' => 'Personal', 'SmallGraphic' => '/templatedata/components/msn.gif' };
        Just for one instance, is this telling me that 'Test2' is the key and {the whole list from var6} are the values? That is how I am interpreting it...