Both use strict; and our affect only the rest of the enclosing block! So in the first case you turned the strictures on only for the rest of the BEGIN{} block, declared that you are going to use the package variable $main::c under the short name $c and then, with no strictures, accessed the $main::c and printed the value you specified in the BEGIN{} block.
In the second case the strict affects the rest of the script, so because the our only declares the $c for the rest of the BEGIN block, strict doesn't allow you to use the short name $c and you get an error.
In reply to Re: BEGIN blocks and use stict positioning
by Jenda
in thread BEGIN blocks and use strict positioning
by codeacrobat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |