LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   include a file in perl script (https://www.linuxquestions.org/questions/programming-9/include-a-file-in-perl-script-316221/)

Ateo 04-22-2005 08:59 PM

include a file in perl script
 
I have a file that I need to include into an existing perl script. The file is nothing more than 3 variables that I wanted to apply to several perl scripts. So my questions are...

1. Since the included file is nothing but varibles, must the first line at the top of this include page still be:
Code:

#!/usr/bin/perl -w
2. In my perl script(s), is the correct syntax to call on that external file:
Code:

require("path/to/filename");
3. I am using "use strict;" in my perl scripts. Is this a problem?

Thanks for any help..

P.S. I am trying to accomplished the eqivilent of the PHP "include" function.

ahwkong 04-22-2005 10:53 PM

1) Not necessary
2) The syntax is wrong.

Try read the doc

perldoc -f do
perldoc -f require
perldoc -f use

You know perldoc right?

3) If it causes problem, it would be about not having proper declarations of the variable


All times are GMT -5. The time now is 10:02 AM.