Hello,John,

As you said,

BEGIN blocks are compiled and run first before any code in main and they have
lexical scope because of the {} brackets.

and in his case:

>
>       #!/usr/bin/perl -w
>       use strict;
>       print "b in main: $b";
>       a();
>       #----------------------
>       BEGIN{
>               our ($b);       
>               my ($fn) = @ARGV;
>               $b = `cat $fn`; 
>
>               sub a {
>                       print "b in a: $b";
>               }
>       }
>


Then,are the statements of 'print "b in main: $b";a();' compiled before BEGIN 
block?or whether the opposition is right?Thanks.

--
Jeff Pang
NetEase AntiSpam Team
http://corp.netease.com

-- 
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