This is an "anti-Perl" idea -> a wrong one. In Perl a sub name has "package" scope, usually, but not always one package "name space" per file.

In a function oriented package, the subs that are meant to be called by others are specified in the @EXPORT (), @EXPORT_OK() lines. In an OO module, you will see subs with names that begin with "_". Those are often names of methods (subroutines) that shouldn't be called by outsiders.

Basically, I suggest "play by the rules and get along with others". I think you are doomed to a life of unhappiness and pain if you insist that Perl work like your other language, which I am guessing is Java. On the plus side, a Perl program is often 1/10th or less than the size of a Java program, so there is less to keep track of!

Perl does allow you to "shoot yourself in the foot". If you provide a "fully qualified name", you can call that sub X in spite of naming and export conventions. I would say simply: "don't do that".


In reply to Re: private sub routine by Marshall
in thread private sub routine by saranperl

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.