Is this what you mean

($exist) ? return 1 : return undef

I think even this should work

($exist) ? 1 : 0;

~Parag



2011/2/9 terry peng <terry.p...@mail.ru>

>
> hello,
>
> when in the case "return undef" I prefer just "return" coz in list context
> it will return an empty list.
>
> my $exist = ...
> if ($exist) {
>    return 1;
> } else {
>    return;
> }
>
> the code above can work, but having many lines.
> So I want:
>
> return $exist ? 1 : (...);
>
> what should be put in (...) to get the same effect as just "return" (not
> return undef)?
>
> regards.
>

Reply via email to