if ( my ($test1_id, $test2_id) = $dbh->selectrow_array( "SELECT .... ") > 0 ) { ... }