$sth->execute(user) or die $db->errstr; $user_info = $sth->fetchall_arrayref(); foreach $info (@{client_info}) { $usr_info[0] = $info->[0]; ... (to [6]) } $num_rows = $sth->rows; return (@usr_info, $num_rows);