Help for this page
use File::Spec; my $goners = 3; # how many? ... my @dirs = File::Spec->splitdir($str); splice @dirs, 0, $goners; print File::Spec->catdir(@dirs);