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} ]; }