PDA

View Full Version : How: call a script into another as a sub routine.


bazz
07-09-2005, 05:20 PM
Hi,

I searched but couldn't find.

Pretty much as the title says.. INstaed of me having an identical sub-routine in several files, I want to place it into a separate file and then call in it as required. How do I call it in - pre-processed.

Bazz

joeframbach
07-09-2005, 06:00 PM
afaik, you can use the use pragma to include other .pl files in your script, compile-time.

FishMonger
07-09-2005, 07:18 PM
Turn the script into a module and call it in like any other module.

use MyModules::module_name;

http://mathforum.org/~ken/perl_modules.html
http://world.std.com/~swmcd/steven/perl/module_mechanics.html