Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: asterisk use

by smist (Acolyte)
on Jan 11, 2007 at 14:19 UTC ( #594159=note: print w/ replies, xml ) Need Help??


in reply to Re^2: asterisk use
in thread asterisk use

In the subroutine named "wanted" that find2perl creates there is usage of the "&&" operator. If I understand it correctly, it's evaluating each expression, and if they evaluate to "true" it prints $name. Is the last "&&" necessary? There are no expressions after it; just goes to the print statement.

sub wanted { my ($dev,$ino,$mode,$nlink,$uid,$gid); (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) && -d _ && print("$name\n"); }


Comment on Re^3: asterisk use
Download Code
Re^4: asterisk use
by Hofmator (Curate) on Jan 11, 2007 at 14:38 UTC
    $foo && $bar && print "something"; is equivalent to print "something" if $foo && $bar;. The last && is necessary in your code because only that makes the whole thing one expression.

    -- Hofmator

    Code written by Hofmator and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (10)
As of 2014-12-22 12:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (117 votes), past polls