Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Expression form of map or grep

by tobyink (Canon)
on Jul 10, 2020 at 21:11 UTC ( #11119163=note: print w/replies, xml ) Need Help??


in reply to Expression form of map or grep

Generally speaking, the block form is more flexible and more readable, however the expression form of grep is pretty readable if you're just doing a regexp match:

my @results = grep /searchterm/i, @inputs;

When things get more complicated than that, I'd generally prefer the block form.

The expression form can run slightly faster if optimization is a concern.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2020-11-01 01:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (291 votes). Check out past polls.

    Notices?