Hi, Roderick. This won't work at all: if( $q->param('dempwd') == $authusers{$q->param('demid')} ) { ... because == is a numeric compare operator, not a string compare. Try perl -d scriptname ... it allows you to step through a program and see exactly what it's doing. Of course for a CGI you have to fake the environment, but cgi.pm is very nice about that: it prompts you for the CGI variables, so you can enter: dempwd=password demid=user Vic Roderick 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 > > >

>