FWIW, years ago, one of my field engineers went off the rails (substance abuse, specifically meth). As one of his ongoing things, he wrote this really neat Perl script (note, singular) to do a lot of post-processing of device data logs. It was 100,000 lines of Perl—everything inline. The script contained parsing, pattern recognition for call flows, presentation—a complete, and insane, expert system. It was as fast as Perl could be in the late Intel Pentium 4/Core Duo laptop days, but it was also completely unmanageable.
Funny what drugs can do.
As a post-mortem, we had to let him go because of our zero-tolerance policy, and he was getting erratic towards the end.
The upside was that he did go through rehab, once on my watch and a couple of times after, and he got himself sorted out for a time. He got a master's degree, of all things, in cognitive psychology from UC Berkeley... Seemed all good until I started getting text messages and voice mails from him on what he believed were forces after him, and asking me for help...
He was a former Navy SEAL and we hired him as a field tech as his first job after he left the US Navy...