Ok Monks, this is just preliminary experimentation with learning Packages and modules, I'm printing the symbol table keys for a very basic package that's created and called within the same file. However, I'm trying to understand why the printing of the symbol table is repeated twice? is it because of the transition between the package namespace and 'main' namespace. I am assuming this since calling a package exports its symbol table to 'main', hence this code reads the package symbol table in the declared package and then reads the same symbol table after it's been exported with 'require' to 'main', can anyone correct and clear this conjecture please?!
print keys(%newPackage::),"\n"; print "\n\n"; require 'newPackage.pl'; #exporting the package namespace. newPackage::subroutine1; package newPackage; #creating the package and its namespace sub subroutine1 {print "*This is a new package called from within the +file*\n";}


Excellence is an Endeavor of Persistence. Chance Favors a Prepared Mind.

In reply to Packages symbol tables and namespaces: by biohisham

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.