Reasonably straight forward.....just keep chopping process down until you get to descrete functional chunks and then write the chunks......The following is an over simplified example of either printing the input page or catching the submitted data and adding it to a text file. A lot is missing - probably should check that name and password exists if submit button is pushed........need to think about maybe using 'flock' on file to prevent users walking on each other..........need to check that output file exists before trying to open it for read......etc.....hopefully the illustration of the flow is useful.<br><br><FONT FACE=monospace><br>#!/usr/local/bin/perl -w<br>use CGI;<br>$thisCGI = '/cgi-bin/develop/junk.cgi'; # <font color=red> change to point to yours</font><br>$query = new CGI;# <font color=red>new CGI object catches submitted data.</font><br>print $query->header;<br>print $query->start_html(-title=>"Title of Page"

;<br>if ($query->param('dowhat') eq 'submit')<br> { <br> # <font color=red>got some data - so - do file stuff - should check that <br> # name and password exist. If not -> Fail.</font><br> $outputFile = 'cgiOut.txt';<br> # <font color=red>should check if file exists here - assuming file already exists.</font><br> open(OPF,"<$outputFile"

¦¦ print "Failed to open OPF, $!";<br> while (<OPF>

{ $buf .= $_; } # <font color=red> read file contents</font><br> close OPF;<br> @lines = split(/\n/,$buf); # <font color=red> split string into lines<br> #For data management chores, you would split lines into values.... <br> # play with the data as you will<br> # maybe,... add the new name and password or use splice as<br> # previously discussed</font><br> $name = $query->param('name');<br> $pass = $query->param('passwd');<br> $line = $name.'¦'.$pass."\n";<br> push @lines,$line;<br> #<font color=red>write final version of array to output file.</font><br> open (OPF,">$outputFile"

¦¦ print "Failed to open OPF, $!";<br> foreach $line (@lines) { print OPF "$line\n"; }<br> close OPF;<br> #<font color=red>Say something nice to your user.</font><br> print $query->h3("Thank You, your data has been submitted."

;<br> }<br>else<br> { <br> #<font color=red> no data exists so - print front page</font><br> print $query->start_form(-action=>"$thisCGI", -method=>"POST"

;<br> print 'Name: ',$query->textfield(-name=>'name', <br> -size=>25, -maxlength=>35),'<BR>';<br> print 'Password: ',$query->password_field(-name=>'passwd',<br> -size=>10,-maxlength=>15),'<BR>';<br> print $query->submit(-name=>'dowhat', -value=>'submit');<br> print $query->end_form;<br> }<br>print $query->end_html;<br></font><br><br>I ran this on my box, then cut and pasted here....but, have also added some comments....hopefully the edits have not boogered any syntax. It aught to be pretty close anyway. 'Hope this helps. <p> <br><a href=mailto: > </a><br><a href= > </a><br> keep the rudder amid ship and beware the odd typo