Re: [INTERFACES] Perl Interface - Mailing list pgsql-interfaces

From Gene Selkov, Jr.
Subject Re: [INTERFACES] Perl Interface
Date
Msg-id 199906230428.XAA01514@antares.mcs.anl.gov
Whole thread Raw
In response to Re: [INTERFACES] Perl Interface  (James Olin Oden <joden@lee.k12.nc.us>)
List 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 by date:

Previous
From: Wade Hampton
Date:
Subject: pgaccess and RH 6.0?
Next
From: Thomas Lockhart
Date:
Subject: Re: [INTERFACES] pgaccess and RH 6.0?