[EMAIL PROTECTED] wrote:
I'm reading the book Programming the Perl DBI to start work with
databases.  The DBI portion I'm getting OK, but I find the reference
here to @$ confusing. (This code is based from the book.)

my $sth1 = $dbh->prepare("select 'SCM_ORDERS_OUT', message_index,
message_no, message_event, time_stamp, data from log");

$sth1->execute();

my @stash;

while ($array_ref = $sth1->fetchrow_arrayref) {
  push @stash, [ @$array_ref ];  ##copy array contents
}

###dump stash contents
foreach $array_ref ( @stash ) {
   print "Row: @$array_ref\n";
}

The rows print out fine, so it "works", but I don't understand how.

@stash is an "Array of Arrays", so to start with I think you should study "perldoc perllol".

I need to be able to work with specific items in the output, such as the column "data". How would I reference it, using this example?

    foreach my $row ( @stash) {
        print "Data: $row->[5]\n";
    }

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to