> Will the inner BEGIN block take precedence over the outer one

I dunno, but I guess I could check...

print "Done\n";
BEGIN {
  print "Top begin\n";
}
BEGIN {
  print "Outer\n";

  BEGIN {
    print "Inner\n";
  }
}
BEGIN {
  print "Bottom begin\n";
}

This prints:
Top begin
Inner
Outer
Bottom begin
Done

So apparently it does.  Interesting.

Rob

-----Original Message-----
From: Dan Anderson [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 25, 2003 9:13 PM
To: Perl Newbies
Subject: Do BEGIN blocks and END blocks have priority?


If I create code with:

BEGIN
{
   # something
   BEGIN
   {
     # something else
   }
}

Will the inner BEGIN block take precedence over the outer one, and thus
load any subroutines or whatever is in the inner begin block?  Or will
the second begin block be ignored and the compiler see:

BEGIN
{
  #something
  #something else
}

Thanks in advance,

Dan


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to