sub x { undef my @x; # @x || return (); # return (@x ? @x : ()); } @y = x(); !defined(@y) && warn "y not defined";
How can I return an empty list instead of an undefined value from x()? In other words, if the results of x() result in its local @x being bound to () or undef, then I want to return an empty list.
In reply to Empty list as a return value by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |