Perl If Else Statement
# Perl IF...ELSE Statement
[ Perl Conditional Statements](#)
An if statement can be followed by an optional else statement, which executes when the boolean expression is false.
### Syntax
The syntax is as follows:
```perl
if(boolean_expression){
# code to be executed if boolean_expression is true
}else{
# code to be executed if boolean_expression is false
}
If the boolean expression boolean_expression is true, the code inside the if block is executed. If the boolean expression is false, the code inside the else block is executed.
### Flowchart

## Example
```perl
#!/usr/bin/perl
$a = 100;
# use if statement to check boolean expression
if($a < 20){
# execute when boolean expression is true
printf "a is less than 20n";
}else{
# execute when boolean expression is false
printf "a is greater than 20n";
}
print "a value is : $an";
$a = "";
# use if statement to check boolean expression
if($a){
# execute when boolean expression is true
YouTip