2 ms·
What's wrong with $fh = open() || die("File did not open") ? The only difference is that the results of `die` are assigned to `$fh`, but I don't think `d
by thedufer 14y ago
What's wrong with
$fh = open() || die("File did not open")
? The only difference is that the results of `die` are assigned to `$fh`, but I don't think `die` even returns. It still short-circuits.
- pyre 14y agoMaybe not in this specific instance, but both operators have different behaviour and different uses.
- draegtun 14y agoNothing is wrong with that. However the actual Perl open() would be like this... open my $fh, '<', 'file.txt' or die "file.txt not found"; open(my $fh, '<', 'file.txt') || die 'file.txt not found'; Above two lines are equivalent.