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

Re^3: Need help understanding code snippet with "grep -f"

by GotToBTru (Prior)
on Dec 23, 2015 at 20:13 UTC ( #1151080=note: print w/replies, xml ) Need Help??

in reply to Re^2:Need help understanding code snippet with "grep -f"
in thread Need help understanding code snippet with "grep -f"

Reading this reminded me .. I had the exact same thing trip me up. -f is not a switch to the grep function but rather an independently defined function that just happens to be used as an argument here. But the unix-familiar mind sees that and thinks "grep -f" is a special form of "grep" and seeks the answer in the grep documentation. And doesn't find it.

Using the block form of grep might have made this clearer.

@files = grep { -f } glob("~/data/*");
But God demonstrates His own love toward us, in that while we were yet sinners, Christ died for us. Romans 5:8 (NASB)

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (11)
As of 2021-04-13 13:24 GMT
Find Nodes?
    Voting Booth?

    No recent polls found