All the Perl that's Practical to Extract and Report

Navigation

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Without JavaScript enabled, you might want to
use the classic discussion system instead. If you login, you can remember this preference.

As usual in Perl:Critic, this policy is optional. I flagged it as a "medium" severity (a 3 on a 1 to 5 scale). Multi-statement maps do legitimate uses, but generally should not be used when you can find a better way to say the same thing (which is most of the time). You can always annotate your code such that Perl::Critic will ignore the violation:

Oooh, argh! Your choice of indentation is painful! If the large chunks are the target, source, map, and map contents, it is semi-sensible to indent based on that. Often, I'd assume this would mean a line per chunk or inlining two or three if they were really simple.The thing that gets me is you close your map guts and then cuddle the source into that. It's what's driving the entire loop! I'd think it rates pretty highly in importance and should be visually distinct. How about another line for it?

Yes, well, multi-statement map() is painful.:-) I used that indentation just to emphasize where the "##no critic" goes, if someone were to want it. In real code, I try to make my maps fit readably on one line, or else I choose not to use map.