Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^4: Count non-empty hash values

by Joost (Canon)
on Oct 23, 2005 at 00:46 UTC ( #502264=note: print w/replies, xml ) Need Help??


in reply to Re^3: Count non-empty hash values
in thread Count non-empty hash values

grep just localizes the "current" item in the list to $_ - that's why /regex/ works in grep (and map and for(each) too): you can do any operation you want on $_ and as long as the statement(s) in the grep block return(s) a true value the original value will be in the resulting list (or in the count, if in scalar context).

I guess this is one of the points where perl is intuitive and "deep" at the same time.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2020-12-05 09:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (63 votes). Check out past polls.

    Notices?