We just use:
sub somefunc { our $Var //= do { say "Heavy calculations"; 42+($ARGV[0]||0); }; }
Best of both.
- tye
In reply to Re: 'state' variables and unit testing (our)
by tye
in thread 'state' variables and unit testing
by vsespb
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |