Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

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 imbibing at the Monastery: (4)
As of 2015-11-29 01:03 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (746 votes), past polls