in reply to Feedback on my understanding of the five Named blocks

Here's a variation on one of your examples that show the difference between INIT and BEGIN:
use 5.010; use strict; use warnings; persist(); INIT { my $store = init_store(); sub persist { say $store++; } } persist(); persist(); sub init_store { 0 } __END__ 0 1 2
But if you change the INIT into a BEGIN, you get a run-time error:
Undefined subroutine &main::init_store called at /tmp/xxx line 10. BEGIN failed--compilation aborted at /tmp/xxx line 14.

Replies are listed 'Best First'.
Re^2: Feedback on my understanding of the five Named blocks
by stevieb (Canon) on Apr 03, 2012 at 21:01 UTC

    This is a wonderful distinction between the two, thank you for the addition! I'll certainly factor this in :)