in reply to || vs or

Should I start using or consistently?
For what it's worth, I always use or for statement modifiers and || as part of boolean expressions.

if ( $1 eq 'A' || $1 eq 'B' ) { ... } open my $fh, "<", $filename or die "can't open $filename: $!";

Replies are listed 'Best First'.
Re^2: || vs or
by Krambambuli (Curate) on May 16, 2007 at 09:33 UTC
    $ perl -mO=Deparse -e 'if ( $1 eq 'A' || $1 eq 'B' ) { }' if ($1 eq 'A' or $1 eq 'B') { (); }
    :) I'm a bit surprized to see that things seem to be OK despite the lack of apostroph escaping - but you see that, at least in this case, 'or' is quite OK.
    Anyway, I try to follow the advice in Damian Conway's "Perl Best Practices" and prefer to write that as
    if( ($1 eq 'A') or ($1 eq 'B') ) { ...}