#! /usr/bin/perl # 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 = ); #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 "Checking username... MATCH\n"; #checking password entered vs that in the passwd file if ($passwd eq $pswd){ print "Checking password... MATCH\n"; } else{ print "Password does not match!\n"; } } else{ print "\"$username\" does not match any users in our database!\n"; } }