in reply to Trouble getting CGI parameters

Your program does two things. It prints HTML output (a form you need to fill in) and then it appends to a data file. But you should only be appending to the data file after the form has been submitted. And your FORM tag has a very weird URL: "http://localhost/newuser.cgi?action=newuser?first?last" doesn't make a lot of sense. You probably just want "http://localhost/newuser.cgi".

Here is a simple program:

#!/usr/bin/perl use CGI; use CGI::Carp qw( fatalsToBrowser ); use strict; use warnings; my $query = CGI->new; # if we got here from a form being submitted, # do the adduser() stuff adduser($query) if $query->param; print << "END_HTML"; <html> <body> <form method="post" action="thisprogram.cgi"> Username: <input type="text" name="user"><br> First name: <input type="text" name="fname"><br> Last name: <input type="text" name="lname"><br> Password: <input type="password" name="pass"><br> <input type="submit" value=" Add User "> </form> </body> </html> END_HTML sub add_user { my ($q) = @_; open PASSWD, ">> $passwd_file" or die "can't append to $passwd_file: $!"; print PASSWD join(":" => $q->param('first'), $q->param('last'), $q->param('user'), $q->para +m('pass') ), "\n"; close PASSWD; }

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart