Table of Contents

An iffy start

An if statement is simple. if the day is Sunday, then lie in bed. A simple test, with two outcomes. Perl conversion (don't run this):

if ($day eq "sunday") {
	&lie_in_bed;
}

You already know that &lie_in_bed is a call to a subroutine. We assume $day is set earlier in the program. If $day is not equal to 'Sunday' &lie_in_bed is not executed (pity). You don't need to say anything else. Try this:

$day="sunday";

if ($day eq "sunday") {
        print "Zzzzz....\n";
}

Note the syntax. The if statement requires something to test for Truth. This expression must be in (parens), then you have the braces to form a block.