http://www.perlmonks.org?node_id=935521


in reply to Is this BEGIN construct supposed to work?

Maybe you want state?
sub routine { state %hash = ...; ... %hash ... }

It's kinda like the following, but the assignment is actually done the first time state is evaluated.

my %hash; BEGIN { %hash = ...; } sub routine { ... %hash ... }