Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!clyde.concordia.ca!nstn.ns.ca!news.cs.indiana.edu!samsung!caen!uflorida!mlb.semi.harris.com!sloth.mlb.semi.harris.com!jdr From: jdr@sloth.mlb.semi.harris.com (Jim Ray) Newsgroups: comp.lang.perl Subject: Re: Need clarification of assoc. arrays Message-ID: <1991Feb6.014939.23488@mlb.semi.harris.com> Date: 6 Feb 91 01:49:39 GMT References: <1991Jan31.033851.19246@uvaarpa.Virginia.EDU> <11245@jpl-devvax.JPL.NASA.GOV> <1991Feb5.233948.21013@mlb.semi.harris.com> Sender: news@mlb.semi.harris.com Organization: Harris Semiconductor, Melbourne FL Lines: 29 Nntp-Posting-Host: sloth.mlb.semi.harris.com In article <1991Feb5.233948.21013@mlb.semi.harris.com> jdr@sloth.mlb.semi.harris.com (Jim Ray) writes: >Am I missing something? I am wanting to use an associative array with >indicies being themselves part of an array ( array of strings ). > >Something like this: > > $areacode{ $phone[0] } = $areacode { $phone[0] } + 1; > >Where $phone[...] is an array of strings containing : > 713 > MAL > > etc..... ie ... they can be text strings and number'd strings. > >Is this possible? ( I already tried printing it out %areacode with > negative results ) Obviously, I didn't understand associative arrays....... Now that I do ( somewhat ), it is fairly obvious what the problem was -- I was printing it out thus: print " %areacode \n"; I should have used : while (($number,$count) = each %areacode) { print " $number =$count\n";} Oh well.... I think I'll buy the book. -- Jim Ray Harris Semiconductor Internet: jdr@semi.harris.com PO Box 883 MS 62B-022 Phone: (407) 729-5059 Melbourne, FL 32901