Answer the question
In order to leave comments, you need to log in
Why doesn't the state function work in Perl without a version?
As stated in the documentation, the state function appeared in version 5.10 and it is necessary to add a directive or higher to the code.
At the moment, version 5.24.0 is on the device, without specifying this directive, the interpreter swears.
I can write and then the code will work.
Why can't I use state without specifying a version? use v5.10;
use v5.24.0;
Answer the question
In order to leave comments, you need to log in
This is for backward compatibility with older versions.
Instead of specifying a version, you can use the feature pragma:use feature qw{ state };
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question