Perl not of a string equals to? -


my $pass = !$message; 

i came across perl code $message string , $pass suppose boolean value. checked as

ok ($pass, $test) 

i confused not (!) of $message?
how tranlate boolean value?

empty string false , nonempty string true?

the ! unary logical negation operator. false strings "" , "0". if such string negated logically, evaluates 1. other strings true-ish. negation of these "" (the empty string) or numerically 0.

other false values undef , number 0.

therefore, ok ($pass, $test) pass if $message undefined, empty string, or zero.


Comments

Popular posts from this blog

pentaho - Carte Status / Kettle Slave Server Status page shows status for random runs instead of the latest run -

R summary function in ddply (plyr) in a simple way -

c# - Are delegates created via lambda expressions guaranteed to be cached? -