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.co.uk - Documentation for the Perl programming language