I would imagine that a public dismembering of a caught hacker (as opposed of incarceration) would be an effective anti-malware tool.
Not that I am opposed to this solution, but the reality is that other hackers would install more malware on your computer while you were busy watching the dismemberment.
Back in the days when pickpockets were hanged, hangings were favorite gatherings for more pickpockets.
I have always maintained that the only penalty that is acceptable for being convicted of hacking is swift and painful execution. No exceptions. That would make the enterprise quite a bit less attractive.
The problem is apprehension and conviction.