in reply to [perlre] grouping parenthesis capture whole string instead of proper subset... why?
lestrat's answer is correct, but you can also do: $setstr =~ s/\|\|$//;if your sole intent is to remove two vertical bar characters at the end.