#! /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 = ); print "\n$passwd\n"; $matchCount = 0; #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"; #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"; } else{ print "Password does not match!\n"; } last; } } # if matchcount did not change, username did not match killing the program if ($matchCount == 0){ die ("\"$username\" does not match any users in our database!\n"); } #opens accounting data file open (DATA, '<', 'IN-accounting.data'); #reading accounting data and assigning values while ($line = ){ ($lastName,$firstName,$ssn,$address,$city,$state,$zip,$payDate,$hours,$rate,$taxes,$deductions,$notes) = split '|', $line; print "$lastName\n"; }