On Fri, Apr 2, 2010 at 3:57 PM, H.Merijn Brand <h.m.brand@xs4all.nl> wrote: > As Tom said, and and or are no safer than && and ||, they just have a > different precedence. The `safer' part is when parens are left out > > open (FOO, "foo.txt") || die $!; OK > open FOO, "foo.txt" || die $!; Wrong > open (FOO, "foo.txt") or die $!; OK > open FOO, "foo.txt" or die $!; OK > And neither is overall safer. One is safer is some circumstances, and the other is safer in other circumstances. You demonstrated when "or" and "and" are safer. Here's one where "&&" and "||" is safer: my $both_successful = ( f() && g() ); OK my $both_successful = f() && g(); OK my $both_successful = ( f() and g() ); OK my $both_successful = f() and g(); WrongThread Previous | Thread Next