Jan 15, 2007 #1 javalsu Programmer Jan 11, 2007 5 US Last time I posted you guys were really helpful, so here I go again. What does it mean when a hash table seems to have two key elements. for example my %htable htable{"n", "g"} = 100 Thanks in advance
Last time I posted you guys were really helpful, so here I go again. What does it mean when a hash table seems to have two key elements. for example my %htable htable{"n", "g"} = 100 Thanks in advance
Jan 15, 2007 #2 ishnid Programmer Aug 29, 2003 1,422 IE You haven't posted valid code there. The usual reason for referencing multiple keys of a hash is to set them at the same time, using a "hash slice". e.g.: Code: @htable{'n', 'g'} = (100,200); So now the value of $htable{n} is 100 and $htable{g} is 200. Upvote 0 Downvote
You haven't posted valid code there. The usual reason for referencing multiple keys of a hash is to set them at the same time, using a "hash slice". e.g.: Code: @htable{'n', 'g'} = (100,200); So now the value of $htable{n} is 100 and $htable{g} is 200.
Jan 17, 2007 1 #3 MikeLacey MIS Nov 9, 1998 13,212 GB Hi javalsu Your code (which I think should look like this) my %htable; $htable{"n", "g"} = 100; It's an old fashioned, but still valid, way of treating a hash as if it is multidensional. You could use this method to store values for all of the squares in a crossword puzzle for instance. $row=1; $col=1; $xwordgrid{$row,$col}='T'; $col=2; $xwordgrid{$row,$col}='E'; $col=3; $xwordgrid{$row,$col}='K'; $col=4; $xwordgrid{$row,$col}='T'; $col=5; $xwordgrid{$row,$col}='I'; $col=6; $xwordgrid{$row,$col}='P'; $col=7; $xwordgrid{$row,$col}='S'; You could then print out the crossword grid using a couple of loops. It's more usual now to use nested hashes and things, but they're a bit clever for me. Mike The options are: fast, cheap and right - pick any two. & Want great answers to your Tek-Tips questions? Have a look at faq219-2884 Upvote 0 Downvote
Hi javalsu Your code (which I think should look like this) my %htable; $htable{"n", "g"} = 100; It's an old fashioned, but still valid, way of treating a hash as if it is multidensional. You could use this method to store values for all of the squares in a crossword puzzle for instance. $row=1; $col=1; $xwordgrid{$row,$col}='T'; $col=2; $xwordgrid{$row,$col}='E'; $col=3; $xwordgrid{$row,$col}='K'; $col=4; $xwordgrid{$row,$col}='T'; $col=5; $xwordgrid{$row,$col}='I'; $col=6; $xwordgrid{$row,$col}='P'; $col=7; $xwordgrid{$row,$col}='S'; You could then print out the crossword grid using a couple of loops. It's more usual now to use nested hashes and things, but they're a bit clever for me. Mike The options are: fast, cheap and right - pick any two. & Want great answers to your Tek-Tips questions? Have a look at faq219-2884
Jan 18, 2007 Thread starter #4 javalsu Programmer Jan 11, 2007 5 US Thanks, after looking at it looks like it is a multidimensional hash table. Now I just have to implement a multidimensional hashtable in vb.net Upvote 0 Downvote
Thanks, after looking at it looks like it is a multidimensional hash table. Now I just have to implement a multidimensional hashtable in vb.net