I am trying to build up associative arrays using a looping draw from a database. I would like to end up with one or more arrays(depending on number of elements in the @Dataset) named %sub0, %sub1, %sub2... and so on. I need to keep these arrays around for latter manipulation.
What I have now is: $c=0; foreach (@Datasets){ my $SQL = "select year,value from data where trend like '%$Datasets[$c]%' order by year"; my $arrayname = "\$sub$c"; my $cursor = $dbh->prepare($SQL); $cursor->execute; while(@columns = $cursor->fetchrow){ $arrayname{$columns[0]} = $columns[1]; #FAILED LEFT SIDE INTERPOLATION } # end while assignment $c++; } However, what obviously is happening is that $arrayname{columns[0]} = $columns[1] is sticking the values into an array called "$arrayname" rather than interpolating back to "$sub0" (or "sub1"... depending on what loop we are in). I've tried various conbinations of quotation marks and eval statements to try to make this work with no luck. Can this be done? If not, is there a standard workaround? Many thanks for any assistance. Andrew Koebrick Web Coordinator/Librarian MN-Planning (Office of Strategic and Long Range Planning) 658 Cedar St., Suite 300 St. Paul, MN 55155 651-296-4156 phone 651-296-3698 fax www.mnplan.state.mn.us -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]