Use your favorite search engine and search for "Perl Authentication Login Scripts". Also, check out
CPAN. There are several modules that already assist in completing this task.
Then if you still have problems post your code and we will try to help. Getting some good perl books would also be a great help.
Perl Cookbook by O'Reilly is a good one to have. Loaded with examples.
--Kevin