$string = join ' where ', grep {$_} ($first, join ' and ', grep {$_} ( $b, $c ));