in reply to remove the part of the string that is after the second to last '/'
#If you don't need the original string: $var =~ s|[^/]+/$||; #If you would like to leave $var unchanged: ($newVar) = $var=~ m|(.+/)[^/]+/$|; [download]