You really ought to be using __END__ instead of __DATA__. See the SelfLoader POD explanation of the way the __DATA__ is intended to be used.

Maybe you can explain this better. I read the SelfLoader POD, and it seems to indicate that __END__ indicates the end of any subroutines in the __DATA__ section. Sort of. It seems to be talking about using the __DATA__ section in packages other than main (I'm referring to sections of the POD that say "works just like __END__ in main"). So if I simply replace __DATA__ with __END__ I can't read from the section. while (my $line = <END>) doesn't work at all. If I add the __END__ token after the __DATA__ then __END__ is read in as a line.

The SelfLoader documentation, as far as I can tell, is used to replace the AutoLoader to be able to do something. I don't write packages, so I am not understanding a lot of the POD. But my best guess is that the __DATA__ section is used for subroutines that might not be called, so you can load them only when they are used. Which doesn't do anything for me, since I'm not writing packages, I'm tossing some input onto the end of my script. I could put the information into another file, and read that, but I don't really see the point of that.

So tell me what it is that I am missing, please.


In reply to Re^2: odd behavior with DATA section by Nkuvu
in thread odd behavior with DATA section by Nkuvu

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.