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

#######################################################
# lect03_greeter1
#
# another subroutine: uses a global variable
# 
# modified by Sharon Tuttle from "Learning Perl",
#    by Schartz and Phoenix
#
# last modified: 9-06-04
#######################################################

# prints a customer greeting that also counts customers

sub greeter
{
    $cust_num += 1;

    print "\n***** Welcome to Perl-mart! *****\n";
    print "Hello, you are customer #$cust_num today!\n";
    print "*********************************\n\n";
}

# call greeter several times, see what happens

&greeter;
&greeter();

# "regular" Perl variables are global --- I can see $cust_num here!

print "\$cust_num: $cust_num\n";
$cust_num = 53;
print "changed \$cust_num to: $cust_num\n";

# ...and so can greeter:

&greeter();

# end of lect03_greeter1