|Just another Perl shrine|
Re: Is there a cleaner way to write this code below, which includes derferencing references, that themselves have to be dereferenced?by stevieb (Canon)
|on May 05, 2022 at 19:50 UTC ( #11143603=note: print w/replies, xml )||Need Help??|
Excellent feedback so far. The only thing I'd add is to lose the comments.
Let the code (ie. the proper naming of variables and function names) do the saying of what is happening. Comments should only be used to describe *why* something is happening. A comment in code should be a rather rare occurrence. If I see a comment in code, it's to point out why the following code is doing something that goes against the norm.
It's readily apparent that execute() and fetchall_arrayref() are performing the "execute command" and "get the data".
I know it's instinctive when first writing code to pepper it with comments, but trust me, if you practice without them, you'll become more efficient as a code reader and writer more quickly. It will force you to come up with more descriptive names for various items within your code.
In Section Seekers of Perl Wisdom