Many Perl libs returns undef if something internal failed.
For example with DBI :
my $result = $sth->fetchrow_hashref();
To simply stop my program in one line (there's an eval at the top caller), since this unique result is always relevant for me to see if all was ok, and lighter than a try/catch, can I always write:
my $result = $theLibraryCall or die "ERROR ..."
It also works for value 0.
question from:https://stackoverflow.com/questions/65919825/perl-die-if-a-variable-is-set-to-undef-correct