Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
B1, B2, B3, BR4, I22, IJ1, IJ17....etc.The coorinates take the form - 1:23,7:59. I was thinking of storing the coorinates as a four dim array - [a1,a2,b1,b2] = [1,23,7,59]. Each zone has a abritary number of coordinates associated with it, such as B1 = [11,21,3,59],[1,23,7,51],[9,2,11,9].
How would I declare a hash to store this type of data? I'd like to add the coordinates on the fly, something like -
How might I do this?for($a1=0;$a1<60;$a1++){ for($a2=0;$a2<60;$a2++){ for($b1=0;$b1<60;$b1++){ for($b2=0;$b2<60;$b2++){ $zone = Get_zone_for_this_coordinate($a1,$a2,$b1,$b2)}; Add_this_coordinate_to_the_hash_for_hash_member_$zone; } } } }
edited: Sat Nov 15 16:55:49 2003 by jeffa - formatting, code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hashing multiple items
by Art_XIV (Hermit) on Nov 15, 2003 at 18:23 UTC | |
by Anonymous Monk on Nov 15, 2003 at 18:49 UTC | |
|
Re: Hashing multiple items
by delirium (Chaplain) on Nov 15, 2003 at 17:56 UTC | |
|
Re: Hashing multiple items
by batkins (Chaplain) on Nov 15, 2003 at 17:27 UTC | |
by etcshadow (Priest) on Nov 15, 2003 at 17:37 UTC | |
by Anonymous Monk on Nov 15, 2003 at 17:43 UTC | |
by CombatSquirrel (Hermit) on Nov 15, 2003 at 17:54 UTC | |
|
Re: Hashing multiple items
by pg (Canon) on Nov 15, 2003 at 19:13 UTC | |
|
Re: Hashing multiple items
by Anonymous Monk on Nov 15, 2003 at 18:22 UTC | |
|
Re: Hashing multiple items
by michaelg (Beadle) on Nov 16, 2003 at 14:52 UTC |