state declares a lexically scoped variable, just like my does.
However, those variables will never be reinitialized, contrary to
lexical variables that are reinitialized each time their enclosing block
state variables are only enabled when the feature'state'
in effect. See feature.
perldoc.perl.org - Official documentation for the Perl programming language