Please send questions to st10@humboldt.edu .
#!/usr/bin/perl -w

#######################################################
# lect03_iffy1
#
# a subroutine to demo that return value is value of
# LAST statement executed
# 
# modified by Sharon Tuttle from "Learning Perl",
#    by Schartz and Phoenix
#
# last modified: 9-6-04
#######################################################

sub flip_flop
{
    if ($prev_val == 0)
    {
        $prev_val = 1;
        "yes";

    }
    else
    {
        $prev_val = 0;
        "no";
    }
}

$prev_val = 1;
print &flip_flop(), "\n";
print &flip_flop, "\n";
print &flip_flop, "\n";
print &flip_flop(), "\n";

# end of lect03_iffy1