|Perl Monk, Perl Meditation|
next in a post-fixed forby Codon (Friar)
|on Jul 06, 2007 at 17:59 UTC||Need Help??|
This may be better posted in Meditations. It sort of touches on both ponderings and obfuscations. I was prototyping an algorithm the other day when I developed a rather obfuscated method for building a hash from two lists. While this is not exactly a full "obfu", I certainly think the behavior could be incorporated into a full obfu. This seems to actually get in to the "what the heck is happening here?" as ysth, gryphon, and especially diotalevi have commented on perverseness of the construct. Without further ado:
The intent of this code is to take a list of patterns and a list of strings and group the strings based on pattern. It also needed to disregard any string that did not match any pattern.
In larger context, this line came from a bit of prototype code I was working on that was
All monks previously mentioned (as well as others), were immediately revolted by such "offensive" code. diotalevi went on to say "Please tell me that you have never committed any code that actually looked like that!" He then went off to try to decipher how it actually worked. I do not think he ever found a satisfactory answer other than the next is a near-no-op with stack manipulation.
The line in question can be re-written in a much more verbose way:
So, what are the thoughts of other monks regarding this obscure construct? Perhaps more importantly, what does the Perl development community say about the behavior (both internal and external)? Is this asking for a future incompatibility? Is it firmly grounded or did I stumble on something that should not work?
Sr. Software Engineer