For one thing, it would make the compiler slower and less stable. Consider:
BEGIN { my $var = do_some_processing(); } __BEGIN__ # start of real processing.. but the compiler has already processed th +e BEGIN block! # ..real code here..
The compiler would have to forget everything it did in the BEGIN block, and if there were side effects (for example, writing to files), all of that would have to be undone.

I suppose your hypothetical __BEGIN__ tag could cause the compiler to simply ignore everything until such a tag is seen.. but what if the tag doesn't exist? the compiler would have to either re-read the file (breaking STDIN, as per merlyn's comment Re: __END__ without __BEGIN__? above), or would have to store a potentially enormous file (plus dependencies) in memory before compilation could truly begin*. This issue doesn't exist with __END__ because the compiler can fall off the end of the file and thus not need to see an __END__ tag.

Of course this could all be complete hooey. Larry may have just left out __BEGIN__ because to include it would be extra work ;)

* - It might do this already, but without the __BEGIN__ tag compilation can begin as soon as perl figures out it has something to work with, which is at least potentially faster.

Update: changed 'more unstable' to 'less stable' - did not mean to imply the compiler was already unstable ;)


In reply to Re: __END__ without __BEGIN__? by moot
in thread __END__ without __BEGIN__? by ktross

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.