if ($string =~ s/^ \{ (.*) \} \z/$1/xs) { print "removed {}\n"; }