LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 04-22-2005, 08:59 PM   #1
Ateo
Member
 
Registered: Sep 2004
Location: http://longbeach.ca.u$
Distribution: Ubuntu,Gentoo, OSX
Posts: 136

Rep: Reputation: 15
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.

Last edited by Ateo; 04-22-2005 at 09:01 PM.
 
Old 04-22-2005, 10:53 PM   #2
ahwkong
Member
 
Registered: Aug 2004
Location: Australia
Distribution: Fedora
Posts: 282

Rep: Reputation: 30
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl cgi Script can`t make file.Why? ZairSadiqov Linux - Software 1 11-22-2006 08:22 AM
Perl Script to download file apt Programming 4 10-19-2005 09:33 AM
perl(Cwd) perl(File::Basename) perl(File::Copy) perl(strict)....What are those? Baldorg Linux - Software 1 11-09-2003 09:09 PM
need perl fuction like c #include statement for header file mrtwice Programming 5 06-19-2003 03:42 PM
Perl Script include mikeshn Programming 1 08-20-2002 10:55 AM


All times are GMT -5. The time now is 02:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration