http://qs321.pair.com?node_id=11113401


in reply to ne vs. ! eq

Precedence. See perlop: ! $s1 eq $s2 is the same as (!$s1) eq $s2, and not !( $s1 eq $s2 ), as B::Deparse will tell you:

$ perl -MO=Deparse,-p -e 'if (! $s1 eq $s2) {}' if (((!$s1) eq $s2)) { (); }

You'll need to write either if ( !( $s1 eq $s2 ) ), if ( not $s1 eq $s2 ), unless ( $s1 eq $s2 ), or of course if ( $s1 ne $s2 ).

Replies are listed 'Best First'.
Re^2: ne vs. ! eq
by boerni (Novice) on Feb 25, 2020 at 13:42 UTC
    Thank you very much haukex!