You are using barewords true
and false
. Bare words are a Bad Thing. If you try this:
use strict;
use warnings;
if (true){print 1}
You'll probably get something like this:
Bareword "true" not allowed while "strict subs" in use at - line 3.
Execution of - aborted due to compilation errors.
Any defined value that doesn't look like 0 is considered "true". Any undefined value or any value that looks like 0 (such as 0
or "0"
) is considered "false". There's no built-in keyword for these values. You can just use 0
and 1
(or stick in use constant { true => 1, false => 0};
if it really bothers you. :)