Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: Default Hash Key

by roboticus (Canon)
on May 02, 2008 at 10:42 UTC ( #684131=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Default Hash Key
in thread Default Hash Key

tford:

perldoc perlop yields:

C-style Logical Or

Binary "||" performs a short-circuit logical OR operation. That is, if the left operand is true, the right operand is not even evaluated. Scalar or list context propagates down to the right operand if it is evaluated.

The "||" and "&&" operators return the last value evaluated (unlike C's "||" and "&&", which return 0 or 1). Thus, a reasonably portable way to find out the home directory might be:

$home = $ENV{'HOME'} || $ENV{'LOGDIR'} || (getpwuid($<))[7] || die "You're homeless!\n";
...roboticus


Comment on Re^3: Default Hash Key
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (20)
As of 2014-07-28 19:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (207 votes), past polls