$filename = '/etc/passwd.bak'; open(FILE, $filename) or die "Could not read from $filename, program stopped."; print "Please enter the username: \n"; $username = ; while(){ chomp $username; if ($username eq @fields[1]){ print "Home directory: $fields[5]\n"; print "Shell used: $fields[6]\n"; exit 0; } if ($username ne @fields[1]){ print "User: $username does not exist.\n"; exit 0; } @fields = split(':', $_); } close FILE;