in reply to Re^2: initialise state variable from list context, NOT!
in thread initialise state variable from list context, NOT!
One of border cases is:
As for state %record;, that is allowed. It's state in a list assignment that is disallowed. But note thatsub foo { (my $foo, state $bar) = (f(), g()); ... } foo; foo; # Should g() be called?
doesn't give you any benefits overstate %record; %record = ( ... );
You will have to write it asmy %record = ( ... );
state %record; %record = ( ... ) unless keys %record;
|
---|
In Section
Seekers of Perl Wisdom