LCLOC of the month
Here's the Least Comprehensible Line Of Code I came across this month. Took me a while to make sure it really did what I thought it did.
my @array;
# ...
@array = map {$_;} (@array, keys %{$this->{'someobject'}->get_some_hash_ref()});
Bonus points for using $this
instead of $self
.
Can you see the revision history for the corresponding file? The {$_;} part rather suspiciously looks like something that was more but cut out (or reversely, something that is meant to grow to multiple statements but has not).
git says that this beautiful line just popped into existence.
Somehow this reminds me of 'Code is poetry' tagline from the right bottom of wordpress.org page. :)
So how did you rewrite this to make it clearer?
any reason
push @array, keys %{$this->{'someobject'}->get_some_hash_ref()};
won't work?
Thanks for the question, Hercynium! It perfectly answers Gabor's question, because the line you posted is almost exactly the line I used to replace that LCLOC.