in reply to remove the part of the string that is after the second to last '/'
$string =~ s!^(.*/).*?/$!$1!; [download]