or download this
use File::Spec::Functions qw/abs2rel/;
my $path = "C:\\Dir1\\Dir2\\Dir3\\KeepMe";
...
my $path = dir('C:\\','Dir1','Dir2','Dir3','KeepMe');
my $base = dir('C:\\','Dir1','Dir2','Dir3');
print $path->relative($base), "\n"; # prints "KeepMe"