coworkers Archives

Why?

I see code…

my @showart;
my @articles;
map {push(@showart, $_) if($_->{'article_description_cat'} eq $category);} @{$alteration};
@articles = sort {$a->{'article_description_rank'} <=> $b->{'article_description_rank'}} @showart;

So what do we have there?

  • A superfluous temporary variable: @showart.
  • A use of map that explicitly throws away map’s return value and goes for the side-effects only.
  • Lines that are way too long.
  • Don’t get me started about the semicolon in the map expression.
  • Don’t make me think about the whitespace that is missing in all sorts of places.
  • An instance of intentional obfuscation?

About confuseAcat

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