in reply to understanding this database error code handling

"Programming Perl 3rd" states it a little differently:

Regardless of which kind of assignment operator you use, the final value of the variable on the left is returned as the value of the assignment as a whole.

So you can look at it like this:

my $result = 'hello'; $result or die "I'm dead"; $result = undef; $result or die "I'm dead down here."; --output:-- I'm dead down here. at line 5.

The fact that a value is returned by the assignment operator let's you do this:

my ($x, $y, $z); $x = $y = $z = 20; print "$x $y $z"; --output:-- 20 20 20

The rightmost assignment executes first.

Replies are listed 'Best First'.
Re^2: understanding this database error code handling
by ww (Archbishop) on Dec 11, 2010 at 14:23 UTC
    7stud (++) is technically correct and the quote cited is worth noting, but beware:
    Your mileage will vary if you use warnings; if you make lines 2 and 5 into print lines, and even if you attempt to run ("test") lines 4 and 5 as a one-liner.

    The last is merely cosmetic;

    >perl -e "$result = undef; $result or die 'I am dead down here.';" I am dead down here. at -e line 1.

    but the other two variants invoke (or illustrate) something quite different than that about which OP appears to have asked.