in reply to Re: Hash Problems
in thread Hash Problems

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.

Replies are listed 'Best First'.
Re: Re: Re: Hash Problems
by Anonymous Monk on May 17, 2001 at 00:05 UTC
    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?
        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.