As the other answers say, Tom Lehrer is making a joke about how enlisted men in the U.S. Army talked differently. So, if you said “haven’t got any,” you wouldn’t fit in, and he’s joking his old drill sergeant would’ve corrected him—but the opposite of the way his audience thought of as right.
This kind of joke can sometimes be affectionate and nostalgic. He was himself conscripted into the Army for two years. However, he hated it, and his song is very disparaging of the other people in the Army.
It’s important to understand that he was writing at a time, the years between the Korean War and Vietnam War, when the Army was much more lower-class than it is today. There was no draft at the time, and he jokes that the kind of people who would enlist were violent felons who only took that option as an alternative to a prison sentence, and morons who failed elementary school to become the smartest person in Officer Candidate School. The generations who served in the previous three wars were used to making fun of the Army’s many foibles and annoyances, and the types he’s singing about were stock characters.
His song is an exaggerated farce, but it’s making fun of a very real attitude. A decade later, Creedence Clearwater Revival would write a much angrier song, “Fortunate Son,” about how the upper classes made sure their sons never had to serve.
No one would perform a song like Lehrer’s today, and it a comedian did, it would be deeply shocking and offensive, not light-hearted.