From: | "Gene Selkov, Jr(dot)" <joden(at)lee(dot)k12(dot)nc(dot)us> |
---|---|
To: | James Olin Oden <joden(at)lee(dot)k12(dot)nc(dot)us> |
Cc: | pgsql-interfaces(at)postgreSQL(dot)org |
Subject: | Re: [INTERFACES] Perl Interface |
Date: | 1999-06-23 03:31:38 |
Message-ID: | 199906230428.XAA01514@antares.mcs.anl.gov |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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, [(at)row];
or
push @set, \(at)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
From | Date | Subject | |
---|---|---|---|
Next Message | Wade Hampton | 1999-06-23 03:56:39 | pgaccess and RH 6.0? |
Previous Message | Christian Borowski | 1999-06-23 02:59:23 |