in reply to Re^2: warning: use of uninitialized value
in thread warning: use of uninitialized value
use strict; use warnings; open my $fh, '<', 'notexistant.txt' or die qq(File open failed); #OK +: File open failed at open (my $fh, '<', 'notexistant.txt') || die qq(File open failed); #OK + too: File open failed at.. open my $fh, '<', 'notexistant.txt' || die qq(File open failed); #WR +ONG print <$fh>; # r +eadline() on closed filehandle $fh at..
Just think of "and" and "or" as being the same as && and ||, but so low on the precedence chart that parenthesis are usually unnecessary to keep the things on the left or on the right properly grouped. It is almost always considered better to use "or" instead of "||" when you work with open.is a quote from a a very useful post about idioms and precedences: Perl Idioms Explained - && and || "Short Circuit" operators
|
|---|