No, use the proper return type for the proper function type. If you return an empty list for false, then you'll be tripped up by something as simple as:
If your function returns lists, then an empty list is likely the correct thing to return for "false". If your function never returns lists, then I'd have it return a false scalar value not an empty list.my %hash= ( this => GetThis(), foo => 'bar', baz => 'biff', ); # Which results in: # $hash{this} eq "foo" # ! exists $hash{foo} # $hash{bar} eq 'baz' # ! exists $hash{baz} # exists $hash{biff}
BTW, my favorite false value is !1 which is a lot like '' except that it won't give a warning if used in a numeric context. (It is what Perl's own functions return for "false but not undefined".)
In reply to Re^4: Condensing code...golfing with push and return (mixed blessing)
by tye
in thread Condensing code...golfing with push and return
by seaver
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |