But what do I actually do with this script?
(Sorry newbie here)
You create a link to the script somewhere on your site. Something like "http://www.yoursite.com/cgi-bin/tellfriend.cgi".
When someone clicks on the link, it displays the form. When someone hits the send button on that form, the script sends an email.
That is very general, you may want to ask more specific questions.
If you have nothing else, use Notepad.
Save the file with a .cgi or .pl extension. Most servers support both, but sometimes it's only one or the other.
If your server is a Windows server, you'll have to ask your host where you should deposit executable scripts, or have them set the permissions on a directory to scripts and executables. It's the Microsoft Way.
If your server is Linux/Unix, you can set the permissions to executable yourself, 755. If you use WS_FTP to upload the file, this can be done by right-clicking the file after upload, select CHMOD, and X all three of the bottom row of checkboxes. Alternatively you can SSH in and do this via command line, but it's not likely you'll have the means.
In either case, upload the file in ASCII mode. This is very important; binary mode will cause some wierdness in the end-of-line characters and it will probably not run.
There is really much more to this - you're likely to get an internal server error the first 10 or 20 tries, and it can be any one of a thousand things. I suggest:
1. Google for ActiveState Perl, download it to your LOCAL computer and install perl onto your system.
2. Open a DOS window (Start->Run-> type "command" on win98, or "cmd" on XP, press enter) and navigate to the directory where your script is
cd C:\folder\path_to\script\location
then run the script locally on your computer to make sure it is error free
perl scriptname.pl (press enter)
Perl is excellent about telling you exactly where your errors are.
3. Once you have the script running locally without error, it eliminates the possibility of anything inherently wrong with it. Upload it and see what happens.
Lots of perl tutorials out there, you may want to predicate your venture with a simple "hello world" script to get the hang. :-)
Then you have to get that text file onto into your cgi-bin directory on your server, wherever that may be.
If I were doing it, I would FTP it up from my local machine to my host provider's machine. I would then shell in to set the priviledges, or use the host provider's web-based file manipulation tool for that.
The script detects (due to the lack of an "action" param) that it is being called the first time, so it displays the form. Then, the user fills in the form and hits send - the script detects that because action is now "send" and it then sends the email.