Let’s say you have some perl code that seems nice and normal:
It defines a constant, and then you use it. It should work fine, right? No. In perl, use constant just makes a sub for that word that when evaluated will return the value, it’s not a “real constant” in a way which other languages have constants. This will fail you whenever you are trying to interpolate or in a hash or basically anywhere.
I genuinely can’t imagine a scenario in which ‘use constant’ would be useful to me.
UPDATE: I’d like to add that the way I’d rather deal with this problem is: