in reply to Feedback on my understanding of the five Named blocks
But if you change the INIT into a BEGIN, you get a run-time error: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
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 |