Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Using hash value as condition.

by graff (Chancellor)
on Mar 30, 2014 at 00:57 UTC ( #1080248=note: print w/ replies, xml ) Need Help??


in reply to Using hash value as condition.

The point here is that "false" is not a reserved word (or a built-in function) in Perl, so it has no special meaning. In your snippet, it's treated as a "bareword", which you can look up under "B" in the perlglossary:

A word sufficiently ambiguous to be deemed illegal under use strict 'subs'. In the absence of that stricture, a bareword is treated as if quotes were around it.

In other words:

perl -le '$x = false; print length($x); print "x is ".join("-",split// +,$x)'
(that will print out two lines: "5" and "x is f-a-l-s-e")


Comment on Re: Using hash value as condition.
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2014-09-20 05:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (153 votes), past polls