joec_ has asked for the wisdom of the Perl Monks concerning the following question:
I have a DBI call which returns three colums as array references (oracle) $row->[0] etc. What i would like to do is keep the first value in $row->[0] matched up to the first value in $row->[1] and matched up to the first value in $row->[2], if that makes sense.
What i have so far is:
Note this is returning an array reference from a subroutine.$sth_ideas->bind_param_inout(":l_proj",\$projects,0,{ora_type=>ORA_RSE +T}); $sth_ideas->execute; while ($row = $projects->fetchrow_arrayref){ $id=$row->[0]; $name=$row->[1]; $perm=$row->[2]; push @proj, $id,$name,$perm; } return \@proj;
Then in another class, i have:
which reads each group of 3 array ref element and prints then in a row (tab seperated). What i need is to be able to do the same thing, but also get at the id value for a particular row (which will be passed to another sub) from a GUI. I think i need a multidimensional array or some such construct, but cant get my head round it.my $count=0; foreach my $e (@$aref){ $count++; if ($count==4){ $count=1; print "\n"; } print $e,"\t"; }
I hope this is clear enough and if anyone has any ideas - they will be appreciated.
thanks -- Joe.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Multidimensional arrays and DB columns
by johngg (Canon) on Dec 12, 2008 at 16:40 UTC | |
|
Re: Multidimensional arrays and DB columns
by mje (Curate) on Dec 12, 2008 at 16:30 UTC |