I need to separate out some routines that I reuse on several perl programs. I want to put them all in an external .pl file that I can by some method include in others. For the sake of clarity I'll call the file with the separate routines the "Library" and the programs that need to call it "Client".
In the Library I want to have something like this.
$variable1 = #SOME CALCULATION
and I want the Client to do something like this...
my $variable1;
require "./Library.pl";
print "$variable1\n";
When I try this, $variable1 doesn't get set properly in the Client program.
I know that the assignment in the Library works because if I print the variable in it, the value is correct.
I am not sure what I'm doing wrong.
Any suggestions?
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.