# CSC 310 Project # 3 #opening passwd file open (PSWD, '<', 'passwd.txt'); #getting username and password #converting username to lowercase if anything is entered in CAPS print "Please enter your username: "; chomp($userN = ); $username = lc($userN); print "Please enter your password: "; #hiding password system ("stty -echo"); chomp($passwd = ); $matchCount = 1; #reading passwd.txt and assigning values while ($lines = ){ ($user,$pswd,$userID,$groupID,$info,$home,$shell) = split ':', $lines; #checking username entered vs that in the passwd file if ($username eq $user){ print "\nChecking username... MATCH\n"; #keeps track if username matches or not $matchCount += 1; #checking password entered vs that in the passwd file if ($passwd eq $pswd){ print "Checking password... MATCH\n\n"; $matchCount -= 2; } else{ print "Password does not match!\n"; } last; } } # if matchcount did not change, username did not match killing the program if ($matchCount != 0){ die ("\nEither the username or password did not match.\n"); } ......