Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Answer: How can I write and call subroutines in separate files?

by chromatic (Archbishop)
on Apr 13, 2000 at 21:11 UTC ( #7490=categorized answer: print w/replies, xml ) Need Help??

Q&A > subroutines > How can I write and call subroutines in separate files? - Answer contributed by chromatic

You can break up the code into logical units:
# file one use File2; setup(); main(); sub main { print "I am in the main subroutine.\n"; } # file 2 sub setup { print "Setting up.\n"; } 1; # use'd files have to return true!

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2017-11-22 08:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (316 votes). Check out past polls.

    Notices?