But if you Google Child Hammer Everything Nail it doesn't show up until a ways down the list. The wording you tend to get is "If your only tool is a hammer, everything looks like a nail" which, to me, doesn't have the same degree of implied gleeful destructiveness.
Also there's the odd "To a man with a hammer, everything looks like a nail", which Robert X Cringely attributes to Mark Twain, but, when you think about it, that form doesn't make a lot of sense. Today, for instance, many men will pick up hammers and the world will not instantly turn all nail-like for any of them. Well, not too many, you'd hope.
This page, on a site named Centerfield, calls it the Law of the Instrument, which it attributes to Abraham Kaplan (although most sites say Abraham Maslow) and renders the phrase "Give a small boy a hammer and he will find that everything he encounters needs pounding." They claim that the phrase is often given as "If you give a child a hammer, everything looks like a nail" which is probably the least coherent version so far and isn't backed up by my experience or Google's.
Centerfield doesn't mention Baruch, but thereby lies another interesting Google. It's variously called Baruch's Law, Observation or Organizational Principle and it's the "If all you have is a hammer, everything looks like a nail" variant that this usually refers to. Maslow turns up again here and a further search on Maslow Hammer Nail seems to suggest that it was the famed (well, I know him because he's connected to a famous, if unrelated, Herzberg) Motivational Theorist who coined the phrase. Which phrase, though, is a little open to question. There are three main variants:
"If the only tool you have is a hammer, you treat everything like a nail."
"If the only tool you have is a hammer, you tend to see every problem as a nail."
"He that is good with a hammer tends to think everything is a nail."
No-one seems to know where, or when, he said any of these, though. His Wikipedia entry just gives it as an interesting quote and leaves it at that. The last variant seems to be edging towards a more Biblical syntax, though, and it, again, doesn't make any sense when you think about it, as a person who is good with a hammer may also be good with something else, a chisel perhaps, so I think we can discount that one.
So we're not quite sure who said it, or quite what they said but I like the phrase, anyway, and I'm sticking with it.
Update: hannah says in the comments that a friend uses a variant to do with PHP. This, in turn, made we wonder if it has become a snowclone. A search for "if your only tool is" "everything looks like a" -hammer gives only 3 snowclones:
- if your only tool is a cruise missile, everything looks like a target
- If your only tool is a penis, everything looks like a blow-job
- If your only tool is MSWord, everything looks like a .doc
"if the only tool you have" "every problem" -hammer also has 3:
- If the only tool you have is C, every problem looks like an operating system
- If the only tool you have is a shotgun, every problem looks for the nearest exit.
- If the only tool you have is an AR-15, then every problem looks like a TARGET.
 Not, of course, anything to do with Maxwell's Silver Hammer. Bang bang!