Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Re: Re: Re:x2 Counting keys with defined or undefined elements in a hash

by jsprat (Curate)
on Jun 05, 2003 at 19:01 UTC ( #263463=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Re:x2 Counting keys with defined or undefined elements in a hash
in thread Counting keys with defined or undefined elements in a hash

The key difference between the two (in this case, at least) is the conditional expression. A plain for loop will iterate faster than grep - but insert a conditional into the for loop, grep will win. Side note, in this thread I learned that grep in scalar context doesn't build the list, it just "returns the number of times the expression was true."*

* ripped directly from perldoc -f grep

And by the way, if you saw how my apartment was decorated before I got married, you'd never worry about my aesthetic sensibilities again ;)


Comment on Re: Re: Re: Re:x2 Counting keys with defined or undefined elements in a hash

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (21)
As of 2015-07-29 17:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (266 votes), past polls