Use else blocks for either/or constructions.
if ($a == $b) {
print "a equals b\n";
$a += $b;
} else {
print "a does not equal b\n";
die "Operation aborted!";
} |
You can string tests together using elsif:
if ($a > 100) {
die "a is too large\n";
} elsif ($a < 0) {
die "a is too small\n";
} else {
print "a is just right!\n";
} |
|
| Contents |
Next |