http://www.perlmonks.org?node_id=266644

Aristotle has asked for the wisdom of the Perl Monks concerning the following question:

I have just come across the first time in a very long while that I feel a need to comment a piece of code. It's the solution for a relatively simple task that I find turned out very natural - if unorthodox. The latter is the reason I wonder whether I'll be able to decipher its meaning in a few months from now.

So first of all, I ask you to take a look at these four lines. All you need to know is that @letter contains symbolic letter names (the Postscript letter names, if anyone's curious) and that %property consists of pairs of all possible letter names and a value of either L, D or X. (Depending on whether the symbolic name represents a letter, a digit or something else as per its Unicode properties.)

Please don't look too hard at the code if you can't figure it out. Read the comment and then look again. My question is - how much help is the comment?

my @letter_seq = map( $curr->[STYLE].":".join(',', splice @letter, 0, length), join('', @property{@letter}) =~ /\G(X|D+|L+)/g, );
The comment:

# to group together letter characters, and digit characters,
# and leave anything else as single symbols, the regex engine
# is run against a map of letter properties put in a
# string. each match on the map is as long as a slice of
# consecutive characters with that property in the array

Makeshifts last the longest.