in reply to Error when adding a number to a variable

The issue is that $8k_m is not a valid variable name. As it says in Variable names in perldata:
Usually this name is a single identifier, that is, a string beginning with a letter or underscore, and containing letters, underscores, and digits.

The interpreter sees that as the variable $8 (the eighth regex capture buffer) followed by the bareword k_m.