[Israel.pm] Python talk

david istermann interdist at gmail.com
Mon Dec 6 22:49:28 PST 2004


If I understand this correctly:

> COMPLICATED_ASSOC_ARRAY = {
>  (0,0) : { "label" : "Origin of the World", "population" : 0 },
>  (0,90): { "label" : "North Pole", "population" : "varies, usually 0"},
>  (0,-90):{ "label" : "South Pole", "population" : ("penguins",10E6)}
> }

you need to give "COMPLICATED_ASSOC_ARRAY" two key values to access
the actual data. This could be accomplished like the following in Perl
(TIMTOWTDI !) :

COMPLICATED_ASSOC_ARRAY = [
  {
    0 => { label => "Origin of the World", population => 0 },
    90 => { label => "North Pole", population => "varies, usually 0"},
    -90 => { label => "South Pole", population => ["penguins",10E6]}
  }
]


Thus, COMPLICATED_ASSOC_ARRAY(0){90}{label} == "North Pole".



More information about the Perl mailing list