>perl -wMstrict -le "my $s = 'TestVar(Test1->(xy))->Var2(Test2(10)(12))->Finalvar'; $s =~ s{ (?<= \w) \( .+? \) (?= ->) }{}xmsg; print qq{'$s'}; " 'TestVar->Var2->Finalvar'