Along with the things Victor mentioned here are a few other suggestions . 1. Always use 'use strict'. It will save you time now and more important, later when the script gets to production. 2. I always checked for 'definedness' and existence (for hashes) of a value before using them. It will save you from error messages like 'undefined variable' and it's good to be sure. This is probably going beyond what you're doing but for future reference.... Depending on where you are using this and how, you may want to look into loading just the routines from CGI.pm that you use in the script. That is use CGI qw/ param header start_html/; just as an example. There's alot more I could go into but it's probably much more than what you need right now. I've been working with Apache/mod_perl for a couple of years now (and with Perl itself for much longer) so if you have any questions or need help, feel free to contact me off list. Dan On Monday 11 February 2002 11:57 am, you wrote: > What is wrong here... I need to validate an name=>password pair, from a > form submission. > > script: > ---------------------------------- > > #!/usr/local/bin/perl -w > # CGI script that creates a fill-out form > # and echoes back its values. > use CGI qw/:standard/; > $q=new CGI; # create new CGI object > %authusers = ('user','password','friend','foe'); > > if( $q->param('dempwd') == $authusers{$q->param('demid')} ) { > > print $q->header, # create the HTTP header > $q->start_html("Hello $1" ), # start the HTML > $q->h1('You are authorized...'), # level 1 header > $authusers{$q->param('demid')}, > $q->param('name'), > $q->end_html; # end the HTML > > } > else > { > print $q->header,$q->start_html("else"), > $q->h1('Failed...'), > $q->end_html; > } > > --------------------------------------- > and here is the form submission... > --------------------------------------- >
>

Demonstrator's ID > >

>

Password > > >

>
> > ________________________________________________ > See http://PLUG.phoenix.az.us/navigator-mail.shtml if your mail doesn't > post to the list quickly and you use Netscape to write mail. > > PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us > http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss