kidd has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using require
by Abigail-II (Bishop) on Jul 10, 2002 at 16:56 UTC | |
by kidd (Curate) on Jul 10, 2002 at 16:58 UTC | |
by Abigail-II (Bishop) on Jul 10, 2002 at 17:03 UTC | |
by kidd (Curate) on Jul 10, 2002 at 17:13 UTC | |
by Abigail-II (Bishop) on Jul 10, 2002 at 17:18 UTC | |
|
Re: Using require
by perrin (Chancellor) on Jul 10, 2002 at 17:16 UTC | |
by kidd (Curate) on Jul 10, 2002 at 17:32 UTC | |
|
Re: Using require
by zentara (Cardinal) on Jul 11, 2002 at 17:07 UTC |