ikegami's right as a BEGIN{require 'constants.pl'} (thanx!) or even a simple peek at %main:: does show.

But I'm still wondering about this section in perldoc -f use:

Because this is a wide-open interface, pragmas (compiler directives) are also implemented this way. Currently implemented pragmas are:
      use constant;
      use diagnostics;
      use integer;
      use sigtrap  qw(SEGV BUS);
      use strict   qw(subs vars refs);
      use subs     qw(afunc blurfl);
      use warnings qw(all);
      use sort     qw(stable _quicksort _mergesort);
Some of these pseudo-modules import semantics into the current block scope (like "strict" or "integer", unlike ordinary modules, which import symbols into the current package (which are effective through the end of the file).

Let me attempt to make sense of it:

Now a BEGIN{require "constants.pl"} basically turns contents.pl into a module. Add a do "y" somewhere near the end in main.pl. Create this file y and have it just print STDERR keys %main::. Copy it to a file z and prepend BEGIN{do "main.pl"}. Run perl -e ./z. Wonder. Check Exporter documentation and do a similar little test with imported symbols. And start WONDERING.

I'm now fully confused, and it's not the missing parens in the quoted section above:

Any ideas on what is actually meant?

cu & thanx, Peter -- --INT due to confusion spell.

In reply to Re^3: Using use itself -- file scope !? by jakobi
in thread Using constants... by willjones

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.