Received: from antares.mcs.anl.gov (mcs.anl.gov [140.221.9.6]) by hub.org (8.9.3/8.9.3) with SMTP id AAA21993 for ; Wed, 23 Jun 1999 00:28:43 -0400 (EDT) (envelope-from selkovjr@xnet.com) Received: from xnet.com (selkovjr@selkovjr.xnet.com [205.243.141.67]) by antares.mcs.anl.gov (8.6.10/8.6.10) with ESMTP id XAA01514; Tue, 22 Jun 1999 23:28:40 -0500 Message-Id: <199906230428.XAA01514@antares.mcs.anl.gov> To: James Olin Oden From: "Gene Selkov, Jr." CC: pgsql-interfaces@postgreSQL.org Subject: Re: [INTERFACES] Perl Interface In-Reply-To: Your message of "Tue, 22 Jun 1999 16:37:04 EDT." <376FF3EF.C450B29B@lee.k12.nc.us> Date: Tue, 22 Jun 1999 23:31:38 -0400 Sender: selkovjr@xnet.com Sorry I did not catch up with the original question; I believe things you discuss here are better answered by reading "man perldata" or "man perlref". But let me make a few comments, anyway. > Looks like you caught my "|" error (-; Seriously, I though the > following should do it: > > while (@row = $result->fetchrow) { > $string = join("\|",@row); > push @set, ($string); > } > > If though you wanted to put them in a multidimensional array (well > really a list of references to lists then you would do something like: > > while (@row = $result->fetchrow) { > push @set, (@row); > } {push @set, ($string)} is the same as {push @set, $string} or {push (@set, $string)} {push @set, (@row); is the same as {push @set, @row} or {push @set, $row[0], $row[1], ...} There is no such thing as multidimensional array in perl. One can simulate multidimensional arrays by using arrays of references. You probably wanted to say, push @set, [@row]; or push @set, \@row; > > and then you would reference each element like this: > > $set[$i][$j] > > or: > > $set[$i]->[$j] > > depending on your mood. which would now now be true. --Gene