Well, as somebody already said, there is HTTP basic authentication. This is configured in your Apache (see
Apache auth howto for example). There are many other modules in Apache to get user/password information from a variety of sources (e.g. LDAP, Databases), if using htpasswd is not an option.
To do this with HTML, you'll need to use a form to request the user/password from the user and implement your session handling yourself. Searching for session handling with CGI and Perl in your favourite search engine should get you more than enough information to get you started...