I prefer File::Basename for that:
use File::Basename; my $base = dirname $0; chdir $base or warn "Couldn't find base directory '$base'. Using current direc +tory.";
This fails if you have weirdo symlinks pointing around. There is FindBin which goes through weird contortions to cover special cases but opens up other venues of failure cases.
In reply to Re: How could you make a script think it's running in its own directory?
by Corion
in thread How could you make a script think it's running in its own directory?
by why_bird
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |