I have tried:
$var = false;
$var = FALSE;
$var = False;
None of these work. I get the error message
Bareword "false" not allowed while "strict subs" is in use.
I have tried:
$var = false;
$var = FALSE;
$var = False;
None of these work. I get the error message
Bareword "false" not allowed while "strict subs" is in use.
I came across a tutorial which have a well explaination about What values are true and false in Perl. It state that:
Following scalar values are considered false:
undef
- the undefined value0
the number 0, even if you write it as 000 or 0.0''
the empty string.'0'
the string that contains a single 0 digit.All other scalar values, including the following are true:
1
any non-0 number' '
the string with a space in it'00'
two or more 0 characters in a string"0\n"
a 0 followed by a newline'true'
'false'
yes, even the string 'false' evaluates to true.There is another good tutorial which explain about Perl true and false.
My favourites have always been
which is completely independent from the internal representation.