use DBI; # MAPDSN is database name $dbh = DBI->connect('dbi:ODBC:MAPDSN'); #pii is table name $access="SELECT aid,piino FROM pii"; $sth = $dbh->prepare($access); $sth->execute(); while (@row=$sth->fetchrow_array) { $pii = $row[0]; $pii1 = $row[1]; $pii{$pii}=$pii1; }