I started using strict not so long ago, and now Im in front of a problem. When I create my scripts I like to make a config.pl so it would be the only thing a user changes(settings, option, that kind of things)...

So yesterday I made the first script this way, only that this time I used strict and -w...

I created my config.pl and added the require line, I test it and oopss...I don't seem to be using the variables inside config...

Could someone give me some light and tell me why it isnt working that way...here is some example...

Let's say I have my "config.pl" with a variable:

#!/usr/bin/perl -w use strict; my $option = 1;

And my main code is like this:

#!/usr/bin/perl -w use strict; require "config.pl" print "Option = 1" if $option != 0;

For some reason $option is not "imported" from config.pl and I can't explain why...thanks


In reply to Using require by kidd

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.