H
h3xx
I have a question about when things are and aren't taken to be a list
when doing boolean comparisons. I tested the following code:
my @foo = qw/ one two three /;
my @bar = ();
my @baz = @bar || @foo;
print "@baz\n";
This produces "one two three." Hence, we know that a list CAN be
returned from a boolean expression. I tried it the other way:
my @baz = @foo || @bar;
print "@baz\n";
This produced "3," the scalar evaluation of @foo. This is the same for
any amount of parentheses and using the "or" operand instead of "||."
Now, what happened?
when doing boolean comparisons. I tested the following code:
my @foo = qw/ one two three /;
my @bar = ();
my @baz = @bar || @foo;
print "@baz\n";
This produces "one two three." Hence, we know that a list CAN be
returned from a boolean expression. I tried it the other way:
my @baz = @foo || @bar;
print "@baz\n";
This produced "3," the scalar evaluation of @foo. This is the same for
any amount of parentheses and using the "or" operand instead of "||."
Now, what happened?