scalar - force a scalar context


scalar EXPR


Forces EXPR to be interpreted in a 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 a list context because it's in practice never needed. If you really wanted to do so, however, you could use the construction @{[ ]}, but usually a simple suffices.