Perl: the Markov chain saw | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
As others have kind of touched on, comments should never explain what the code actually does. If you ever feel the need to to explain code, then you do need to rewrite it to make it clearer.
I think that your rewritten version is clearer, but I feel the problem in the original is the splice. I have developed a well earned loathing of tinkering with arrays like that. I prefer to map or push elements and work on them methodically. I think you could do it a little more lisp like with multiple maps taking the place of the join and regexp, but that's personal style, and that would require a temporary variable outside the scope of the map block. But temporary variables aren't always bad.
____________________ In reply to Re: I wrote some clever code - can the comment "defuse" it?
by jepri
|
|