Next | Program Repair Shop | 31 |
scalar is perhaps the most misunderstood of Perl's builtins
Every Perl expression is in scalar context or list context.
This depends on whether Perl expects it to produce a scalar or a list.
Canonical example:
$s = expression;
@a = expression;
In the first case, the expression is expected to produce a scalar.
In the second case, the expression is expected to produce a list.
Expressions do different things depending on context
Next | ![]() |
Copyright © 2006 M. J. Dominus |