Re: [INTERFACES] Perl Interface
От | Gene Selkov, Jr. |
---|---|
Тема | Re: [INTERFACES] Perl Interface |
Дата | |
Msg-id | 199906230428.XAA01514@antares.mcs.anl.gov обсуждение исходный текст |
Ответ на | Re: [INTERFACES] Perl Interface (James Olin Oden <joden@lee.k12.nc.us>) |
Список | pgsql-interfaces |
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
В списке pgsql-interfaces по дате отправления: