- Selecting multiple rows
my $data = {}; my $sth = $dbh->prepare( 'SELECT name, colour, shape FROM thing WHERE smell=?' ); $sth->execute('bad'); while ( my $row = $sth->fetchrow_hashref ) { $data->{$row->{colour}}{$row->{shape}} = $row; }
my $data = {}; my $sth = $dbh->prepare( 'SELECT name, colour, shape FROM thing WHERE smell=?' ); $sth->execute('bad'); while ( my $row = $sth->fetchrow_hashref ) { $data->{$row->{colour}}{$row->{shape}} = $row; }