Too bad, true. But I still don't understand why it doesn't print the two other lines.

In my Great Foolishness(tm), I had always thought that there could only be one BEGIN block by package. So as I was reading merlyn's answer to the question, I thought to myself: "Ah! easy! I just have to embed the eval'd block in another BEGIN block, to make sure it'll be evaluated first."

Alas, the "you lose!" block was the first printed in the block and then the "hello/goodbye" lines. Mmmh, too bad.

Then, I realized that anything outside the BEGIN block in the sub was not executed.

What is happening exactly? Does a BEGIN code inside a sub never returns? Can someone point me a node where all these mysteries are unveiled? Thanks!

<kbd>--
PerlMonger::Paris(http => 'paris.pm.org');</kbd>

In reply to Re: DANGER - was Re: Re: Syntax Error Checking by OeufMayo
in thread Syntax Error Checking by madhatter

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.