Is 'learn' the new 'teach'?
With seemingly increasing frequency I come across a phrase using 'learn' when I think it should be 'teach'.
The classic example is 'that will learn them!', as in "Shoot all criminals - that will learn them!". I thought this was being deliberately wrong for comedic effect, in keeping with the general sentiment of the sentence.
Another example from a Stack Exchange site (http://programmers.stackexchange.com/questions/53880/stuff-you-should-have-learned-in-school-but-didnt-pay-attention-to-at-the-time)
I don't know if you can learn someone to write at this age
Am I being overly fussy/old fashioned or is this just wrong?
In standard English, using learn to mean teach is incorrect. It is, however, a feature of some non-standard dialects. The examples you give all seem to be to be using learn for comedic effect, mimicking the non-standard dialects where this sort of thing is common.
It is not quite correct that, as some answers here suggest, this is "the" archaic sense of the word learn.
Nor though, is it quite wrong either.
It is an archaic sense, that is still found in some dialects.
In the sense of acquiring knowledge, we have learn going back as far as Bede and other Old English writers.
In the sense of imparting knowledge, we have learn going back not quite so far, but still as far back as Wycliffe's Bible and other Middle English writers.
That it is today labelled "vulgar" in some dictionaries means that it remains current in some dialects, but is not generally considered standard or the language an educated person would use. Still, a book considered definitive enough on the Scouse dialect to have been used in the old IANA language registration has the wonderful title, Lern Yourself Scouse.
The classic example is 'that will learn them!', as in "Shoot all criminals - that will learn them!". I thought this was being deliberately wrong for comedic effect, in keeping with the general sentiment of the sentence.
It depends on the speaker. Some people whose dialect would not have them normally use learn in this sense will still use the expression "that'll learn you" and variants ("that'll learn them" and other objects that it will "learn"). It does indeed use a degree of humour, though it's not so much that it is incorrect (and hence at odds with the statement) as just a common enough expression among those whose dialect does allow for that use, as to have become an idiom. In particular, some dialects would allow this sense of learn only informally, and therefore to use such an informal expression when this sense of the word doesn't otherwise exist in your dialect at all is actively informal. The humour isn't in "being wrong" it's in taking pains to be informal.
Of course, one can still make use of it as humorously uneducated too. When Wodehouse has an upper-class character say of the English public school system, "If you ask me, they don't learn the little perishers nothing." then it is precisely this sort of humour.
When however, Twain writes "Then he remarked that he had undertaken to 'learn' me all about a steamboat, and had done it;" he is distancing his narrator from the use with quotes, but reporting on a realistic use, rather than poking fun.
Actually, there are two different Old English words in question: leornian, meaning "to acquire knowledge", and læran, meaning "to teach". Both developed into the Modern English form "learn" (and the latter into the participial form "learned", i.e. "well-taught". German has cognates lernen and lehren with the same respective meanings.
According to Etymonline.com, læran was more commonly used to mean "teach" than its ancestor, tæcan. I'm not sure when the switch from using one to using the other occurred.
In addition to what @JSBangs said, you might consider the possibility that the word is being used by the authors in a humorous or ironic sense.