X
xhoster
Hi,
my program is getting big and I'd like to split it into multiple files,
something like C guys do.
Why? Is it so big that it is crashing your favorite text editor?
main.pl
include file1.pl
include file2.pl
etc
I tried both do and require but they doesn't work as I expect:
I can't use the global variables I declare into main for the subrutines
declared into other files.
I assume that by "global" you mean file-level lexicals.
Generally, you are supposed to pass arguments into subroutines, not pick
them up randomly from the symbol table/pad.
How can I do?
If you don't want to experience the benefits of using file-level lexicals,
then don't use them. Use package variables instead (or much better,
redesign your program into multiple files along lines such that you don't
need variables to cross the boundaries.)
Xho