Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

What is boolean context in perl?

user-image
Question added by Sameer Ahmed Z , Project Assitant , Indian Institute of Science
Date Posted: 2016/06/06
Mohammad kasid
by Mohammad kasid , ICT Engineer (Sr. Database Administrator) , Ericsson Global India Ltd.

Boolean context is simply any place where an expression is being evaluated to see whether it's true or false.

sreenivasa murthy Raju
by sreenivasa murthy Raju , Technical Lead , Saudi Telecom Company

Perl does not have specific boolean type, but every scalar value when it checked using if condition will be either true or false.

for example:

if($variable eq "Hello")

{

   print "Value is True\\n";

}

The number 0, strings '0' and '', and "undef" are all false in a boolean context.

 

Boolean context holds true and false value.

There is three way we can identify the false statement

1.if the value is 0

2.if the value is " " i.e. null

3.if the value is undef

Except these three all the values are conidered as true.

More Questions Like This