Perl Best Practices Pdf Apr 2026

Chapter 4: Don’t use $a and $b outside of sort() .

After twelve hours of triage, Erwin’s boss slid a printed email across the desk. “The auditors want a ‘Readability and Maintainability Compliance Plan.’ By Friday.” perl best practices pdf

Over the next three nights, Erwin didn’t rewrite the code. He performed surgery with the PDF as his scalpel. He wrapped bare blocks in do { } . He replaced if(!$var) with unless($var) . He added perlcritic to the CI pipeline and watched its severity ratings drop from “brutal” to “stern.” Chapter 4: Don’t use $a and $b outside of sort()

He thought of the thirty-seven lines where $a held a transaction ID and $b held a customer’s social security number. He performed surgery with the PDF as his scalpel

The junior dev, remorseful, asked how to help. Erwin slid her a USB stick. “Read Chapters 1 through 7. Then rename every $temp variable to something that means something.”

The system didn’t break again. And when someone asked why, Erwin would tap the side of his monitor and say: “The PDF teaches you how to write code for the person who finds your body.”

Erwin was a archaeologist of broken things. While other sysadmins chased cloud-native glitter, Erwin maintained the legacy core—a sprawling Perl backend that processed global financial settlements. The code was old enough to vote, buy a drink, and run for local office. It had no tests, no consistent indentation, and variables named things like $x2a and $foo_final_FINAL .