It's easy to do it the other way round - force list context. This can be done with (function(...)).Putting parenthesis around an expression does NOT create list context:
Perhaps you are confused with:sub context {wantarray ? "LIST" : "SCALAR"} my $context = (context); print $context, "\n"; __END__ SCALAR
sub context {wantarray ? "LIST" : "SCALAR"} my($context) = context; print $context, "\n"; __END__ LIST
In reply to Re: Forcing scalar context
by Anonymous Monk
in thread Forcing scalar context
by rinceWind
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |