in reply to saving form data to a text file

OK, here's a slightly less terse answer:

Use the object-oriented interface for CGI.pm, and then use the save method of that object to write out all of your data to a file. VERY basic structure:

use CGI; my $q = CGI->new(); open FILE, "> cgi-data.txt" or die "Can't open file for write: $!\n"; $q->save(FILE); close FILE;

There's a lot more you'll need to look up to turn this into a useful application, but that should get you started.