in reply to how to avoid chdir(directories) ?

I'll use the following directory tree in my examples:
/my/prog/bin/script.pl /my/prog/data/file.txt

I passed the path to the data as an argument, but it can be hardcoded or even dynamically constructed.