[Melbourne-pm] fetchrow_array() vs fetchrow_arrayref() WAS RE: Perl DBI reference recommendations

Daniel Pittman daniel at rimspace.net
Thu Jul 16 21:24:41 PDT 2009


"Leigh Sharpe" <lsharpe at pacificwireless.com.au> writes:
> Sam's example earlier used this:
>
>>while (my $row = $sth->fetchrow_arrayref) {
>>  my ($foo, $bar) = @$row;
>>  print "$foo  $bar\n";
>>}
>
> Is there any advantage to using fetchrow_arrayref() here, instead of:
>
> while (my ($foo, $bar) = $sth->fetchrow_array()) {
>   print "$foo  $bar\n";
> }

Not really, except the greater risk of using a scalar context and consequently
throwing away all but the first column.

Regards,
        Daniel

-- 
✣ Daniel Pittman            ✉ daniel at rimspace.net            ☎ +61 401 155 707
               ♽ made with 100 percent post-consumer electrons


More information about the Melbourne-pm mailing list