From: terry peng <terry.p...@mail.ru>
To: beginners <beginners@perl.org>

Sent: Thu, February 10, 2011 2:07:43 PM
Subject: about return


>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. 


Will this work for you, Terry?

my $exist = ......
$exist ? return 1: return;

Rgds.



      

Reply via email to