in reply to scalar context confusion
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: scalar context confusion
by Narveson (Chaplain) on Feb 28, 2008 at 16:04 UTC | |
by chromatic (Archbishop) on Feb 28, 2008 at 18:57 UTC |