1 2 3 4 5
my $oldlink = 'www.google.de/foo/bar.html'; my @ls = split("\/", $oldlink); delete $ls[-1]; my $link = join ("\/", @ls, ""); print $link;