Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!sdd.hp.com!caen!ox.com!ox.com!emv From: emv@ox.com (Ed Vielmetti) Newsgroups: comp.lang.perl Subject: Re: associative arrays of arrays Message-ID: Date: 21 Feb 91 20:31:30 GMT References: <1991Feb21.051208.21101@mlb.semi.harris.com> Sender: usenet@ox.com (Usenet News Administrator) Organization: OTA Limited Partnership, Ann Arbor MI. Lines: 24 In-Reply-To: jdr@sloth.mlb.semi.harris.com's message of 21 Feb 91 05:12:08 GMT In article <1991Feb21.051208.21101@mlb.semi.harris.com> jdr@sloth.mlb.semi.harris.com (Jim Ray) writes: I would like to build an associative array which in turn points to lists ( one per key ). $array{$name} = SOME LIST Where SOME LIST is some array ( list ) of indices into another set of arrays containing relivant record information. This array would be periodically added to while traversing the entire list of people. What I have done for this (without perfect luck yet, I admit) is to simply make the "SOME LIST" a space-delimited string of indexes. When you need to get the list out as a list you do a split on it, e.g. $sets{"csound"} = "1990.03:123.Z 1990.06:105.Z 1991.02:3458.Z" ; $sets{$name} .= " " . $key ; # add a key @keys = split(" ",$sets{$name}) ; # get your list back you'll probably want and, or, xor, sort, and uniq operators on these things too. --Ed