The following code generates the warning Useless use of private variable in void context at noname.pl line 6. Line 6 being my $baz = $foo or $bar;:
use warnings; use strict; my $foo = 3; my $bar = 2; my $baz = $foo or $bar; print $baz;
The code prints 3 as expected despite the warning. Using || in place of or "fixes" the problem. Is this a (benign) bug, or something I don't understand about or?
This is using AS Perl 5.8.6
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |