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 |