Peter Rabbitson <mailto:[EMAIL PROTECTED]> wrote:

: I have some trouble understanding why a BEGIN block behaves the
: way it does. Here are two files to demonstrate:
:
[snip code]
: What makes the difference?

    'use' and 'BEGIN' blocks are compiled by Perl before our().
So your script is compiled by the Perl interpreter in this order.

: #!/usr/bin/perl
: use warnings;
: use strict;
: use test2 qw($var);
:
: BEGIN {
:     print "I see $var but don't see $var2\n";
: }
:
: our $var2 = 'second';


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
254 968-8328


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to