in reply to Assigning the result of a chomp to the chomped var itself.

Generally speaking, you should avoid reading and modifying a variable in the same expression. You run into tricky and undefined areas.

For many operators, operand evaluation order is undefined. While it's not explicitly defined for the assignment operators, the fact that local $x = $x; is guaranteed to work strongly implies that the RHS side of that operator is evaluated before its LHS.

As such, there's a strong implication that the observed behaviour is a bug.

Update: LHS being evaluated first wouldn't cause $x to get cleared.