Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Subroutines loaded in from ohter files

by tune (Curate)
on Nov 28, 2002 at 15:58 UTC ( #216329=note: print w/ replies, xml ) Need Help??


in reply to Subroutines loaded in from other files

The easiest way is to use the "require" directive. Others will recommend using packages, but you can still go with the less painful solution of "require". A file should like this (eg. functions.pl):

#!/usr/bin/perl sub routine1 { # this routine's code here } sub routine2 { # another routine's code } 1;
Note the "1;" at the bottom. In the main file you need the following line somewhere at the beginning:
require "functions.pl";

--
tune


Comment on Re: Subroutines loaded in from ohter files
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://216329]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (9)
As of 2014-09-18 07:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (109 votes), past polls