in reply to BEGIN { } block

Prior to Perl version 5.10, a  BEGIN block could also be used to initialize 'static' lexical variables in a subroutine closure. The  state variable of 5.10 implements 'static' lexicals. See Persistent Private Variables in perlsub.

Prior to 5.10:

>perl -wMstrict -le "S(); S(); { my $s = 'hiya'; sub S { print $s++ } } S(); " 0 1 hiya >perl -wMstrict -le "S(); S(); BEGIN { my $s = 'hiya'; sub S { print $s++ } } S(); " hiya hiyb hiyc
With 5.10 (the -E switch enables 5.10 features):
>perl -wMstrict -lE "S(); S(); sub S { state $s = 'hiya'; print $s++ } S(); " hiya hiyb hiyc