Perl Else If

[Solved] Perl Else If | Perl - Code Explorer | yomemimo.com
Question : perl if else

Answered by : charlesalexandre-roy

# Basic syntax:
if (condition_1) {	print "condition_1 was met\n";
}
elsif (condition_2) {	print "condition_2 was met\n";
}
else {	print "for everything else, there's Mastercard\n";
}
# Note, some people like to shorten the syntax like this:
if (condition_1) {	print "condition_1 was met\n";
} elsif (condition_2) {	print "condition_2 was met\n";
} else { print "for everything else, there's Mastercard\n";}
# Example usage:
my $variable = 3;
if ($variable > 5) {	print "Three is greater than 5\n";
}
elsif ($variable < -7) {	print "Three is less than negative 7\n";
}
else {	print "Apparently 3 falls between -7 and 5\n";
}

Source : https://www.tutorialspoint.com/perl/perl_if_elsif_statement.htm | Last Update : Fri, 11 Mar 22

Answers related to perl else if

Code Explorer Popular Question For Perl