I'll use the following directory tree in my examples:
/my/prog/bin/script.pl
/my/prog/data/file.txt
- You can use a relative path to the data (e.g. /my/prog/bin> script.pl ../data/file.txt)
- You can use an absolute path to the data (e.g. /my/prog/bin> script.pl /my/prog/data/file.txt)
- You can run the script from the data directory (e.g. /my/prog/data> ../bin/script.pl file.txt)
- You can even mix and match (e.g. /my/prog> bin/script.pl data/file.txt)
I passed the path to the data as an argument, but it can be hardcoded or even dynamically constructed.