It is often a good idea to have your configuration files or your code contain relative pathes to various locations as that makes it easy to install your application in different places.

It also makes it a lot easier to run two totally separate copies of the same program on the same machine.

However, when accessing the files it is often better to use the absolute path-es.

So the question arises: How can you convert a relative path to an absolute path?

There are are several way you can do even with standard Perl modules:

examples/absolute_path.pl

use strict;
use warnings;
use 5.010;

use Cwd qw(abs_path);
use File::Spec;

my @cases = ("..", "../Perl-Maven", "../perlmaven.com");
for my $path (@cases) {
    say $path;
    say File::Spec->canonpath( $path );
    say abs_path($path);
    say '';
}

perl examples/absolute_path.pl

examples/absolute_path.out

..
..
/home/gabor/work

../Perl-Maven
../Perl-Maven
/home/gabor/work/Perl-Maven

../perlmaven.com
../perlmaven.com
/home/gabor/work/perlmaven.com