in reply to Re^2: map BLOCK evaluation context
in thread map BLOCK evaluation context
or can supply list contexts to its arguments, but it always returns a scalar... or at least, I've never seen it return a list.
use Data::Dumper; my @A = qw(1 2 3); my @B = qw(A B C D); print Dumper(@A or @B);
In example C, or does return a scalar. You just don't do anything with the scalar. print @list or die is not parsed as print(@list or die); it's parsed as print(@list) or die. Therefore, print only sees the list; it doesn't see the result of the or operator.
Update: meh... the right hand side of or can result in or returning a list:
use Data::Dumper; my @A = qw(); my @B = qw(A B C D); print Dumper(@A or @B);
The left hand side cannot.
|
|---|