http://qs1969.pair.com?node_id=676660

why_bird has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

Is there a way of tricking a perl script into thinking I'm running it from it's own directory, even when I'm running it from somewhere else?

For example, I have a script called backup.pl, and I want to create an alias to just type 'backup' in the shell and for that to run my backup.pl. However, the way I've written it, it needs to run in it's own directory (e.g. to create dated folders in ~/other/BACKUP/ which is where the script resides..)

I suppose I could hard-code all the file names etc in the file, but having written it badly :O (but also out of general interest in understanding how these things work) I'm wondering if there's any way to tell it that I want it to create the folders in it's own folder rather than where I run it from.

cheers, why_bird
........
Those are my principles. If you don't like them I have others.
-- Groucho Marx
.......