my $sql = <prepare($sql); $sth->execute(); $sth->bind_columns(\my ($col1, $col2)); my %data; while ($sth->fetch) { push @{$data{$col1}}, $col2; }