3 ms·
Honestly, writing perl in "C" style is really a good idea. At least if not pushed to extremes. It avoids a lot of unreadability and confusion. Other things I t
by acveilleux 10y ago
Honestly, writing perl in "C" style is really a good idea. At least if not pushed to extremes. It avoids a lot of unreadability and confusion.
Other things I think make for good perl style:
* Never use unless, especially as the after-statement conditional and/or with a negation. (I once spent a whole day ripping my hair out to figure out that an unless with a negated clause that was itself ambiguously named did the exact opposite of what it seemed to. Think [...] unless not $unregulated;)
* Do use foreach wherever possible.
* Keep reference usage to where it's really needed.
* When in doubt, don't write new OOP code. (The benefit to the caller has to be much greater than the extra complexity in implementation.)
* Lists are the core data-structure and regex are first class construct.
* Avoid the use of implicit $_/@_.
* Avoid the use of explicit $_.
* Use map / grep / sort and similar in pipelines but don't nest too deep on a given line.