...one of the MTOW you promote TDI is, if not wrong, then sub-optimal
One of the points I make in PBP is that "sub-optimal" is not a easy thing to judge as soon as you have more than one metric to optimize. PBP suggests at least four: maintainability, robustness, performance, and conciseness (and argues that that is the approximate order of importance of the four).
The recommendation to use anonymous hashes when passing one-off argument lists trades a little less performance for a little more conciseness, some improved robustness, and (if used consistently throughout the code) better maintainability.
Of course, you're perfectly correct to factor out the hash memory reallocations into a single declaration if you're going to repeat the same call hundreds (or millions) of times, but as a default habit, just building an anonymous hashref at the point you need it is cleaner, less error prone, and more concise. And the performance cost on a single call at modern processor speeds isn't worth the hassle of coordinating between separate hash declarations and uses.
All of which is why inlined hashes were the default recommendation in PBP.
PS: You also asked what worse mistakes I made in PBP. One of them was not finding a way to adequately get across that the advice in the book is meant to be a starting point, a default zero-state, an initiator of conscious thought, rather than an end-point of discussion. Gods know, I tried to convey that (devoting most of the first chapter to the idea), but I stupidly didn't put any code in that chapter, so most readers just seem to skip straight over it. :-(
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||