return 1 if $status == 0; return; # a return by itself implicitly returns an empty list
It's true that return by itself returns an empty list in list context. But it returns undef in scalar context -- not scalar( () )! ;)
Updated: Simply added a quote of what I was refering to, since the thread grew quite long. Improved punctuation to boost readability. Removed unneccesary extra link to return.
In reply to Re^2: variable set to 0 ? 0 : 1 (return by itself returns undef in scalar context)
by Flexx
in thread variable set to 0 ? 0 : 1
by c
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |