Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: Expression form of map or grep

by parv (Vicar)
on Jul 13, 2020 at 05:53 UTC ( #11119235=note: print w/replies, xml ) Need Help??


in reply to Re^2: Expression form of map or grep
in thread Expression form of map or grep

In the code as shown, "map" just melds in the array reference construction. Perhaps that is what you prefer.

I personally would either make a temporary variable to hold the map result; or rearrange the code to highlight map function. On the second note ...

'troll' => [ 'troll', map( "$_ troll", qw(desert freshwater giant ice saltwater snow spectr +al), 'two-headed' ), 'trobold', @$tralg, @$throglin ]

Replies are listed 'Best First'.
Re^4: Expression form of map or grep
by Lady_Aleena (Curate) on Jul 13, 2020 at 10:39 UTC

    I could spread it out, but there are almost 100 lists like it in the module. That is almost 100 lines Perl::Critic does not like too.

    My OS is Debian 10 (Buster); my perl versions are 5.28.1 local and 5.16.3 or 5.30.0 on web host depending on the shebang.

    No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
    Lady Aleena

      Why do you care about number of lines for their own sake? The example had 1 single statement; after spreading that out, there was still only 1 statement.

      The added whitespace out was not for Perl::Critic. It was for my own sake, and for any future maintainer including myself, to make it easier to see that the array reference was not just a plain word list.

        Would you accept that I do not like scrolling and use the syntax highlighter to keep sane? 8)

        My OS is Debian 10 (Buster); my perl versions are 5.28.1 local and 5.16.3 or 5.30.0 on web host depending on the shebang.

        No matter how hysterical I get, my problems are not time sensitive. So, relax, have a cookie, and a very nice day!
        Lady Aleena

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11119235]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2020-10-20 15:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (210 votes). Check out past polls.

    Notices?