Questions about this topic? Sign up to ask in the talk tab.
Difference between revisions of "Perl/Basics/Boolean Logic/Helper Natives"
From NetSec
AlizaLorenzo (Talk | contribs) (Created page with "These helper natives are '''boolean''' statements that assist with the determination of the existence of or the defining of a variable.") |
Chantal21I (Talk | contribs) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
These helper natives are '''boolean''' statements that assist with the determination of the existence of or the defining of a variable. | These helper natives are '''boolean''' statements that assist with the determination of the existence of or the defining of a variable. | ||
+ | |||
+ | ====exists==== | ||
+ | {{:Perl/Basics/Boolean Logic/Helper Natives/Exists}} | ||
+ | |||
+ | ====defined==== | ||
+ | {{:Perl/Basics/Boolean Logic/Helper Natives/Defined}} | ||
+ | |||
+ | ====undef==== | ||
+ | {{:Perl/Basics/Boolean Logic/Helper Natives/Undef}} |
Latest revision as of 01:25, 19 July 2012
These helper natives are boolean statements that assist with the determination of the existence of or the defining of a variable.
exists
The exists native applies specifically to hashes and hash references.
print "This user has an age.\n" if exists $user->{'age'}; |
defined
The defined native determines if a scalar value is defined:
print "We received a response from the server.\n" if defined $response; |
undef
The undef native determines if a scalar value is un-defined:
print "We received a response from the server.\n" unless undef $response; |