All you have done is forced perl to do it's best to turn a string into a number.
Try assigning var to 23g, 23 g 23.0g, and you'll see it just gets converted. The better question is, why don't you want the implicit conversion?
Play that funky music white boy..