Perl Monk, Perl Meditation | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I have just come across the first time in a very long while that I feel a need to comment a piece of code.
I wonder how much that need gets reduced after some minor reformatting. My preference is to use the the other form of map, add parenthesis to make the splice more readable, and make the implicit argument to length explicit. To my eye, that makes the intent a bit clearer. Then, when I look at what needs commenting, I'm drawn to two things: First, that @letter_seq doesn't contain the same thing as @letter (which I found misleading at first read). Next, the final join. The latter issue can be clarified by a using a carefully named temporary variable. I find this more readable (YMMV), but still wonder if the algorithm is what you really intend. The properties you're extracting from the collapsed property string don't correspond with the start of the substring of @letter that you're extracting. That part puzzles me.
In reply to Re: I wrote some clever code - can the comment "defuse" it?
by dws
|
|