J
J Krugman
I don't know whether this is a bug or what, but it's about the most
bizarre Perl "quirk" (to keep it printable) I've ever come across,
and I've seen my share. If I run the following Perl script:
$x = $y = 1;
$y ||= ($x &&= 0);
print "$x\n";
The output is
1
!!! What on earth is up with THAT??? Just to make sure I was not
losing my mind, I ran this script as well:
$x = $y = 1;
($x &&= 0);
print "$x\n";
and the output was empty (undef), as expected. Why should the &&=
assignment have a different effect depending on whether one prepends
"$y ||= " to it or not?
jill
bizarre Perl "quirk" (to keep it printable) I've ever come across,
and I've seen my share. If I run the following Perl script:
$x = $y = 1;
$y ||= ($x &&= 0);
print "$x\n";
The output is
1
!!! What on earth is up with THAT??? Just to make sure I was not
losing my mind, I ran this script as well:
$x = $y = 1;
($x &&= 0);
print "$x\n";
and the output was empty (undef), as expected. Why should the &&=
assignment have a different effect depending on whether one prepends
"$y ||= " to it or not?
jill