in reply to Re^8: map in void context
in thread map in void context
... as far as I am aware I cannot define side-effects for a subroutine in Perl....
It's easy:
use 5.010; sub square_a_number { my $value = shift; $Some::Global::Variable += $value; say "Squaring the value '$value'"; return $value * $value; }
There are two trivial side effects, as well as the non-obvious side-effect of setting SvNOK on $value.
|
|---|