It converts non-boolean types to boolean (dualvar(0,"")
or 1
).
It is a shortcut way of doing this, instead of trying to cast it explicitly (which may take more characters). The !
operator negates the truthness of its argument. Hence, two of them are used.
Many object types are “truthy”, and others are “falsey”.
- The only false values are
0
,undef
,""
,"0"
and some overloaded objects. - Examples of true values are
1
,"asdf"
, and all other values.