At 11:18 AM 5/30/01 -0700, Peter Cornelius wrote:
> > Use:
> >
> > if (@ARGV and -T $ARGV[0]) { ... }
>
>Just wondering if there is a reason for using the lower precedence 'and'
>here instead of '&&'? I haven't been finding many uses for 'and' which
>tells me I might not fully understand it.
The way I teach it is, I use && in expressions, and 'and' for (lazy ways
of) changing the flow of control. Yeah, I know there's no difference, but
it reads nicer to me and the different precedences happen to minimize
parenthesization for these usages.
So
$user = $ENV{USER} || $ENV{USERNAME} || $ENV{LOGNAME};
if ($flirting && $flouncing) { ... }
but
open GRIMBLE, $plugh or die "open $plug: $!\n";
$found = 1 and next if /$pattern/;
YMMV.
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com