Wed, 9 Feb 2011 22:44:10 -0800 (PST) письмо от "C.DeRykus" <dery...@gmail.com>:
> 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 : ();
>
Does return () in the caller's list context will return an undef?
regards.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/