7.5. elsif

The full syntax of the if statement is as follows:

if ($condition0)
{
}
elsif ($condition1)
{
}
elsif ($condition2)
{
}
.
.
.
else
{
}

The N-th elsif block will be executed only if all the conditions in the previous blocks were not met and its own condition was met.

You can do the same with nesting if statements inside else statements, but isn't it nice of perl to save you all those extra brackets and indentations?


Written by Shlomi Fish