codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  ARRAY OF HASHMAPS  dansteu at 13:22 on Wednesday, July 16, 2008
 

Hi!
I have an array which contains associative maps. I pass this array to a function using "my @arr= @_". In debug mode, when I am over @arr I can see that in function this value is passed rightly because values are my maps. The problem starts when I try to extract the single maps in it. For esample I believed that doing my %map = $arr[0] I could obtain the map in zero position but it is not so. In debug mode I obtain a variable with undef value and name (HASH056E...). Then I cant't loop my map to extract keys and values....
Please help me.
Thanks very much.
Da

  Re: ARRAY OF HASHMAPS  hermanningjaldsson at 14:28 on Thursday, July 17, 2008
 

have u tried:

my %map = %$arr[0];

?


i think the values in @arr are basically just references to hashes, but not actually hashes.




  Re: ARRAY OF HASHMAPS  dansteu at 19:40 on Thursday, July 17, 2008
 

ok yes with "my %map = %{$arr[0]};" it is ok
Thanks

  Re: ARRAY OF HASHMAPS  hermanningjaldsson at 18:09 on Sunday, July 20, 2008
 


my $name_of_hash = $arr[0];
my %map = %{$name_of_hash};

#its more readable this way.









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
• I Need Help
• User input validation
• Create a wrapper for a COM Dll
• HashMaps
• HashMaps
• NEED HELP! Urgent
• Re: Exciting Open Source Project in C++
• Re: The Ballarat Airline Company (BAC)
• Re: problem getting prompt window to work on IE


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2008