Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Simple Q. for You

by Anonymous Monk
on Mar 16, 2018 at 14:02 UTC ( [id://1211036]=note: print w/replies, xml ) Need Help??


in reply to Simple Q. for You

Also, the && bit is an example of short-circuit logical expression evaluation, which is a fairly standard feature of most languages. Since "false AND anything" is always False, the right-hand side of the expression won't be evaluated at all if the left-hand side is determined to be false. (It, so to speak, instead "takes the short circuit.") The programmer is using this to avoid referencing a property of something that is in a hash if that thing isn't in the hash, thus avoiding a runtime error.

Replies are listed 'Best First'.
Re^2: Simple Q. for You
by Your Mother (Archbishop) on Mar 16, 2018 at 14:29 UTC

    Except of course that referencing a missing hash element is not a run time error, sundialsvc4. If the most basic features and behavior of Perl are mysterious to you, just let others do the answering. You're doing no favors to anyone, especially yourself.

Re^2: Simple Q. for You
by Anonymous Monk on Mar 16, 2018 at 14:06 UTC
    P.S. Exactly the same sort of short-circuit behavior occurs with regard to logical-OR, "||". If the left-hand side is determined to be true, the right-hand side is skipped since "True OR anything" is always True. You most-often see this in Perl as something like open(FD) or die("can't open"). If the file is opened successfully, the code won't die, and vice-versa.

      And I'm sorry to carry this on further since I know a lot of monks are willing to just drop it and are getting mad at me because I shan't but this aggression will not stand, man.

      haukex wrote a perfect—Perfect.—reply to the OP. It covered everything with linked citations and sample code. It's the ideal. Friendly. Comprehensive. Broke down the basics with references for further reading. Explained clearly in plain English. It was also just there to bolster two already terrific answers from trippledubs and syphilis. Everyone involved, including me, cited the previous posts to build each other up and show respect.

      Five and one half hours later you post not just one but two half-baked rehashes of it. Awful. Useless. Pointless. Helpless. Insulting. Shameful.

      Update: added missing verb. Maleducatto. Idiota. Che scemo.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-19 21:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found