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.

6 Comments

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).

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?

Leave a comment

About confuseAcat

user-pic Random observations that may in some way be related to Perl.