use v5.10; или выше.use v5.24.0; и тогда код заработает.
use feature qw{ state }; state is available only if the state feature is enabled or if it is prefixed withCORE::. The state feature is enabled automatically with ause v5.10(or higher) declaration in the current scope.