The short answer: you should be doing "libraries/somelib.pl" rather than requireing it. Reading over the docs for do (specifically, do EXPR, not do BLOCK... they are (sadly) not very closely related) and require would probably be a good idea, but the executive summary is: require will only execute it the first time it is seen in a perl process (because the expectation with require and use is that the file is a "package" or "module" and things are either exported or referred to by namespace... they don't have to be defined anew in each require-er).

Of course, you could also go the better route, and turn "libraries/somelib.pl" into a real module, and use it... but that will be more work (probably worth it, though).

------------ :Wq Not an editor command: Wq

In reply to Re: Perl use and require enigma by etcshadow
in thread Perl use and require enigma by devnul

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.