in reply to multidimensional array's
Here is sample code:
Also, access to a scalar element of an array is correctly written asmy @allrows = @{ $sth->fetchrow_arrayref() }; # Expand ref, to simplif +y access my $first_author = $allrows[0][0]; my $second_author = $allrows[1][0]; my $first_title = $allrows[0][1];
$language = $row[2]; # Correct $language = @$row[2]; # wrong (at least in perl ver 5)
"By three methods we may learn wisdom: First, by reflection, which is noblest; Second, by imitation, which is easiest; and third by experience, which is the bitterest." -Confucius
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: multidimensional array's
by space_monk (Chaplain) on Dec 28, 2012 at 10:43 UTC | |
by NetWallah (Canon) on Dec 28, 2012 at 20:11 UTC | |
by emgi (Initiate) on Dec 29, 2012 at 09:20 UTC | |
by NetWallah (Canon) on Dec 29, 2012 at 15:56 UTC |