Hi All
I have the following problem and don't know how to resolve it.
Basically, I have a perl .pl file (main.pl) that requires another .pl file (routines.pl) in order to work correctly (everything running on a Linux machine). The files are both in the same folder and I currently use the following syntax in the file main.pl
require "./routines.pl";This works fine if I run main.pl from the folder that contians the two files. However if I run the program from a different folder with, say, the command
perl /home/user/code/main.plThen I get an error saying "can't locate ./routines.pl.
I know that I can change the "require" statement to:
require "/home/user/code/routines.pl"However, for me, this is not an option as I need to copy the code to another Linux system where the containing folder will be different (the two files will still be in the same folder)
So, my question: Is there any way to use the same "require" statement so that I can run my program from any folder with the command
perl /home/user/code/main.plwhere the folder for the code (/home/user/code/main.pl) can change?
Please let me know if anything is not clear.
Many thanks for any help on this
gauss76
In reply to using "require" problem by gauss76
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |