#!/usr/bin/perl
#w3.4.pl  the for statement

@people = (Jim, Floyd, Fred, Jane, Marta, Jill, Sam, Joe, Alice, Andrea);

print("Please enter your name: ");
chomp($name = <STDIN>);

for ($a=0;$a <= $#people; $a++) {	# $#people counts @people
#   print ("Last person is at sub $#people\n");
#   print ("DEBUG: $people[$a]\n");	#DEBUG
   if ($people[$a] eq $name){
      print("Yes, you can use our computer.\n");
      $success = 1;
      last;
   }					#End if block
}					#End for block

if (!$success){
   print("Sorry $name, you are not on my list.\n");   
}

__END__

