programming-examples/perl/Statement/unless statement with elsif.pl

15 lines
367 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
$variable = 2;
unless ($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";
}