CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
How to include 1 script in other script



Apr 9, 2012, 4:52 AM

Post #1 of 2 (701 views)
How to include 1 script in other script Can't Post

I have two scripts "" and "". I have written some common functionality in so that i can use it in other scripts.
Can someone give some idea on how to include this to other scripts?

I can think of 3 ways to do it :
1) do
2) use ""
3) require ""

I am not sure which one is best. Is there any other way to do it?


Apr 9, 2012, 8:40 AM

Post #2 of 2 (688 views)
Re: [naven8] How to include 1 script in other script [In reply to] Can't Post

The best answer is "none of the above". Without an extremely good reason to do otherwise, your common functions should be put in a module. The module should be included with the command like:

use qw( func1 funct2 );

Refer to the "Perl Modules" section of perldoc perlmod for a template for creating a module.
Good Luck,


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives