According to perldoc Cwd, you might get better results if you invoke getcwd() rather than cwd(). The documentation is a bit vague about how symlinks are treated, but what you need is something that will walk its way up the directory hierarchy, ignoring possible hints from environment variables like PWD, or invoking commands that might employ such hints,
In reply to Re: Resolving correct directory path in a symlinked directory
by jpl
in thread Resolving correct directory path in a symlinked directory
by beermad
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |