in reply to Re^3: What can we assume in a BEGIN block ?
in thread What can we assume in a BEGIN block ?

The variable $initialized was declared by the my $initialized. This made it known the parser so when the source code farther down saw it, it incremented the variable. At the time, the value was still undefined because while the variable had been declared, the = 0; hadn't run yet. So now $variable = 1 after the BEGIN. Now that the file is finished being parsed, execution starts at the top so now you run $initialized = 0;.

$variable := undef -> 1 -> 0