http://www.perlmonks.org?node_id=403952


in reply to working with relative paths

Relative paths should work with chdir, being relative to where you are when you run (not where the script is). Example from a Solaris Perl 5.8 system:

use strict; use Cwd; print "cwd [1] = ", cwd(), "\n"; chdir("/tmp"); print "cwd [2] = ", cwd(), "\n"; chdir("steve"); # relative! print "cwd [3] = ", cwd(), "\n";
produces:
cwd [1] = /export/home/foo cwd [2] = /tmp cwd [3] = /tmp/steve