in reply to "or die" versus "|| die"
It's too easy to make precedence mistakes if you use the || variety for this kind of flow control. Witness later in that same faq: http://perldoc.perl.org/perlfaq5.html#How-do-I-randomly-update-a-binary-file%3f the error in the line:
Rule of thumb: use || when you are actually using the result of the operation, otherwise use or.read(FH, $record, $RECSIZE) == $RECSIZE || die "can't read record $r +ecno: $!";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: "or die" versus "|| die"
by brian_d_foy (Abbot) on Jun 24, 2005 at 15:59 UTC | |
by halley (Prior) on Jun 24, 2005 at 16:33 UTC | |
by brian_d_foy (Abbot) on Jun 24, 2005 at 16:39 UTC | |
by ysth (Canon) on Jun 24, 2005 at 19:11 UTC |
In Section
Seekers of Perl Wisdom