in reply to Useless use of string in return statement

G'day Bod,

When you encounter this sort of issue, you'll often find using B::Deparse, to see how Perl interprets your code, will help.

$ perl -MO=Deparse,-p -e 'return $x or $y' ((return $x) or $y); -e syntax OK $ perl -MO=Deparse,-p -e 'return $x || $y' (return ($x || $y)); -e syntax OK

— Ken

Replies are listed 'Best First'.
Re^2: Useless use of string in return statement
by Bod (Parson) on Apr 13, 2021 at 15:04 UTC

    Thanks Ken
    I've seen B::Deparse mentioned here and there and keep meaning to find out what it does and why I might want it. I guess you've just answered that for me!