programming-examples/perl/Statement/If statement ladder.pl
2019-11-15 12:59:38 +01:00

16 lines
365 B
Perl

$variable = 2;
if ($variable == 1) {
print "Yes, it's one.\n";
} elsif ($variable == 2) {
print "Yes, it's two.\n";
} elsif ($variable == 3) {
print "Yes, it's three.\n";
} elsif ($variable == 4) {
print "Yes, it's four.\n";
} elsif ($variable == 5) {
print "Yes, it's five.\n";
} else {
print "Sorry, can't match it!\n";
}