use DBI; my $dbh = DBI->connect($dsn, $login, $password, { RaiseError => 1 } ); my $sth = $dbh->prepare('/* some adequate SQL query */'); o o o $sth->execute($user); my $r_udata = $sth->fetchrow_arrayref; $sth->finish; # $r_udata is a reference to an array where each element matches # the corresponding column on the query passed to ->prepare() o o o $dbh->disconnect;