my %hash; my %rec; my $sth = $db->prepare ("select * from tablename"); $sth->execute; $sth->bind_columns (\@hash{@{$sth->{NAME_lc}}}); while ($sth->fetch) { $hash{$rec{week}} = [ $rec{month}, $rec{workperiod} ]; } #### my %hash; my $sth = $db->prepare ("select week, month, workperiod from tablename"); $sth->execute; $sth->bind_columns (\my ($week, $month, $workperiod)); while ($sth->fetch) { $hash{$week} = [ $month, $workperiod ]; } #### my $dbh = DBI->connect ("dbi:$driver:", "user", "pass", { FetchHashKeyName => "NAME_lc" }); my %hash; my $sth = $db->prepare ("select week, month, workperiod from tablename"); $sth->execute; while (my $rec = $sth->fetchrow_hashref) { $hash{$rec->{week}} = [ $rec->{month}, $rec->{workperiod} ]; }