Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2016-05-30 21:51 GMT
Find Nodes?
    Voting Booth?