Does this work?
It should be `++$weight` in your case I think.