Perl: If Else

Submitted by programmer on Thu, 04/15/2010 - 12:08.
::

Conditional statements may involve logical operators (Perl if else) and usually test equality or compare one value to another.

Here's a look at some common Perl If Else conditional statements.

#!/usr/bin/perl
 
$city="London";
 
if ($city eq "Paris") {
print "The city is Paris. ";
}
elsif ($city eq "Tokyo") {
print "The city is Tokyo. ";
}
else {
print "The city is London. ";
}