|The stupid question is the question not asked|
Closure Over Scalar?by QM (Parson)
|on Feb 18, 2021 at 15:48 UTC||Need Help??|
QM has asked for the wisdom of the Perl Monks concerning the following question:
I've been closing over hashes for years, for subs that need some persistent store, but not wanting to invoke memoize.
Below I've closed over a scalar and a hash. I get a warning of:
With hashes, this just works, but apparently the hash is empty, and that's fine. But the scalar value within the sub is undef.
What am I missing?
What is the easiest way to fix this, while still using a scalar to store a string, that is later used as a hash key?