in reply to Hash Problems

Show us the Data::Dumper output of %temp_dcr. It helps.

Replies are listed 'Best First'.
Re: Re: Hash Problems
by wstarrs (Acolyte) on May 16, 2001 at 23:59 UTC
    Here is the output:
    $VAR1 = 'Test1'; $VAR2 = { 'ShowHome' => 'Personal', 'RightNavExpirationDate' => 20010521, 'RightNavLaunchDate' => 20010515, 'SmallGraphic' => '/templatedata/components/msn.gif' }; $VAR3 = 'Name'; $VAR4 = [ 'RightNavLaunchDate', '', 'RightNavExpirationDate', '', 'LinkURL', '', 'SmallGraphic', '', 'ShowHome', '', 'ShowBusiness', '', 'ShowPersonal', '' ]; $VAR5 = 'Test2'; $VAR6 = { 'ShowHome' => 'Home', 'RightNavExpirationDate' => 20010520, 'RightNavLaunchDate' => 20010510, 'ShowPersonal' => 'Personal', 'SmallGraphic' => '/templatedata/components/msn.gif' }; $VAR7 = 'PromoPH'; $VAR8 = { 'ShowHome' => 'Home', 'RightNavExpirationDate' => 20001215, 'ShowPersonal' => 'Personal', 'SmallGraphic' => '2000-12-13' }; $VAR9 = 'TestLinkPH'; $VAR10 = { 'LinkURL' => '/templatedata/components/test.asp', 'RightNavLaunchDate' => 'Home', 'ShowPersonal' => 'Personal', 'SmallGraphic' => '/templatedata/components/msn.gif' }; $VAR11 = 'OfferNavP'; $VAR12 = { 'ShowHome' => 'Personal', 'RightNavExpirationDate' => 20000517, 'RightNavLaunchDate' => 20000516, 'SmallGraphic' => '/templatedata/components/msn.gif' }; $VAR13 = 'PromoP'; $VAR14 = { 'ShowHome' => 'Personal', 'RightNavExpirationDate' => 29991620, 'RightNavLaunchDate' => 20000618, 'SmallGraphic' => '/templatedata/components/msn.gif' }; $VAR15 = 'TestLinkP'; $VAR16 = { 'LinkURL' => '/templatedata/components/test.asp', 'ShowHome' => 'Personal', 'RightNavExpirationDate' => 20000430, 'RightNavLaunchDate' => 20000421, 'SmallGraphic' => '/templatedata/components/msn.gif' }; $VAR17 = 'OfferNavPH'; $VAR18 = { 'ShowHome' => 'Home', 'RightNavExpirationDate' => 20000523, 'RightNavLaunchDate' => 20000519, 'ShowPersonal' => 'Personal', 'SmallGraphic' => '/templatedata/components/msn.gif' }; Can't coerce array into hash at C:\Program Files\Interwoven\TeamSite\l +ocal\bin\G enerate_Right_Nav.ipl line 199.
      Where do you insert the 'Name' key? It is the Array. It is an other Value than the other keys.
        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.
        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?