3 ms·
Perl's context addresses this in a useful way; a function can be called in a void context (no value expected), a scalar context (one value expected) or a list c
by DougWebb 13y ago
Perl's context addresses this in a useful way; a function can be called in a void context (no value expected), a scalar context (one value expected) or a list context (multiple values expected.) The function can detect which context it's being called in and alter it's response accordingly.
List context works really well with list assignment, which lets you assign multiple return values directly to muliple scalar variables. It also works well with passing multiple return values to the input of another function, of course.
- deleted 13y ago[deleted]