On Feb 9, 10:07 pm, terry.p...@mail.ru (terry peng) wrote:
> 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)?
>

return $exist ? 1 : ();

--
Charles DeRykus




--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to