codeacrobat has asked for the wisdom of the Perl Monks concerning the following question:
If I declare a variable in early stages like BEGIN or INIT then shouldn't the scope be there in the later stages too?$ perl -e 'BEGIN{use strict; our $c=1} print $c' 1 $ perl -e 'use strict; BEGIN{our $c=1} print $c' Variable "$c" is not imported at -e line 1. Global symbol "$c" requires explicit package name at -e line 1. Execution of -e aborted due to compilation errors.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: BEGIN blocks and use stict positioning
by Fletch (Bishop) on Apr 20, 2006 at 18:19 UTC | |
|
Re: BEGIN blocks and use stict positioning
by Jenda (Abbot) on Apr 20, 2006 at 18:19 UTC | |
|
Re: BEGIN blocks and use strict positioning
by ikegami (Patriarch) on Apr 20, 2006 at 21:58 UTC | |
by Anonymous Monk on Apr 21, 2006 at 08:02 UTC | |
|
Re: BEGIN blocks and use strict positioning
by davido (Cardinal) on Apr 20, 2006 at 22:00 UTC |