in reply to Re: Perldoc's explanation of the difference between '&&' and 'and' has me confused
in thread Perldoc's explanation of the difference between '&&' and 'and' has me confused

I agree in principle, but I tend to also use and and or in very complex expressions to be able to use less parens:

if (($foo && ($bar || $zebra) && ($fox & $mask) && $option_x) || ($zul +y & $mask2 || $lion)) {

=>

if ($foo && ($bar || $zebra) && ($fox & $mask) && $option_x or $zuly & + $mask2 || $lion) {

most often with line breaks. The "or" and "and" will be bold in my editors syntax highlighting making it even more clear what the logical groups are. YMMV.


Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^3: Perldoc's explanation of the difference between '&&' and 'and' has me confused
by LanX (Saint) on Jul 05, 2021 at 18:07 UTC
    Honestly, I find this still pretty unreadable.

    Probably because it's a contrived example?

    If this actually was realworld code I'd add many line-breaks and comments for each line.

    Or even better break it down into speaking variables for sub-terms.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      Or break it down into multiple statements.

      Seeking work! You can reach me at ikegami@adaelis.com