Pete Emerson wrote: > > Mar 16, 2003 at 5:08pm from Rob Dixon: > > RD> (print 'abc') + ($success = 0) + (last); > > Rob, thanks, this example helps drive the point home. Would you also argue > that > > open INFILE, $file || die "Can't open $file: $!"; > > should really be written as > > die "Can't open $file: $!" if (!open INFILE, $file); > > or is this a different kettle of fish?
Because of the higher precedence of || they do not do the same thing. The first statement is equivalent to: open INFILE, ( $file || die "Can't open $file: $!" ); You need to use the lower precedence 'or': open INFILE, $file or die "Can't open $file: $!"; Or use parenthesis: open( INFILE, $file ) || die "Can't open $file: $!"; Also, 'if !' is usually written 'unless' die "Can't open $file: $!" unless open INFILE, $file; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]