in reply to Re: What could make "()" a good value for boolean false?
in thread What could make "()" a good value for boolean false?

That makes sense - thanks.

So is return (); as opposed to simply return; (the two behave the same) a widely accepted convention or just a matter of personal taste?

Replies are listed 'Best First'.
Re^3: What could make "()" a good value for boolean false?
by Anonymous Monk on Mar 27, 2016 at 21:29 UTC

    So is return (); as opposed to simply return; (the two behave the same) a widely accepted convention or just a matter of personal taste?

    its not a convention, there are no conventions ... its extra typed chars that serve no purpose , don't see why anyone would adopt that as a style or a convention ...

Re^3: What could make "()" a good value for boolean false?
by LanX (Saint) on Mar 27, 2016 at 21:10 UTC
    > (the two behave the same)

    no, they do the same!

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

Re^3: What could make "()" a good value for boolean false?
by ikegami (Patriarch) on Mar 31, 2016 at 02:58 UTC

    I hope not, because I'm opposed to it. Sub that are expected to return a scalar shouldn't suddenly return nothing. It causes subtle problems that aren't caught by the compiler.

    Consider what happens if type suddenly returned nothing instead of `undef`:

    my $h = { type => type(), name => name(), };

    return (); should be used for subs that are expected to return a list.

    return undef; should be used for subs that are expected to return a scalar. There are exceptions, of course.