scalar
scalar
scalar EXPR
Forces EXPR to be interpreted in scalar context and returns the value of EXPR.
@counts = ( scalar @a, scalar @b, scalar @c );
There is no equivalent operator to force an expression to be interpolated in list context because in practice, this is never needed. If you really wanted to do so, however, you could use the construction @{[ (some expression) ]}
, but usually a simple (some expression)
suffices.
Because scalar
is a unary operator, if you accidentally use a parenthesized list for