use File::Spec; use warnings; use strict; my $file2 = 'whatever it is'; my $abs_path = File::Spec->rel2abs($file2); print $abs_path, "\n";