use File::Spec; my $rel_path = File::Spec->abs2rel($CurrentPath, $BasePath);