Note that if I were doing this for real I would not use a regex match to accomplish it but would use split for brevity or a module to cover edge cases and portability. However, here is one solution. This might not achieve what you want because it isn't clear precisely what you do want. It should provide a starting point at least.
use strict;
use warnings;
use Test::More;
my @tests = (
{
in => ' /x/y/z/a/b/c/d/e.f',
want => '/c/d/e.f'
}
);
plan tests => scalar @tests;
my $re = qr#((?:/[^/]*?){3})$#;
for my $t (@tests) {
$t->{in} =~ $re;
is $1, $t->{want}, "Extracted $t->{want}";
}