The concatenation operator (.) operates on two scalars, so its operand expressions are evaluated in scalar context. In scalar context @list evaluates to the number of elements in @list.
An array name in a double-quoted string is not a Perl expression. It's not evaluated normally. Context cannot be determined from the surrounding code, cause it's not in Perl code. An array name in a double-quoted string is replaced with the result join($", @array), and $" defaults to a space.
Update: Minor tweak to wording for preciseness.
Update: Removed misleading quotes as per reply.
In reply to Re: scalar context confusion
by ikegami
in thread scalar context confusion
by perlplayer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |