use File::Spec; my $file = '/' . File::Spec->abs2rel($fullpath, $startdir);