Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Expression form of map or grep

by tobyink (Canon)
on Jul 10, 2020 at 21:11 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11119163]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-25 12:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found