chessy has asked for the wisdom of the Perl Monks concerning the following question:

Hi guys,

I have had to use perl in order to develop a solution to a problem. Please forgive me if I am writing to basic but I have only been using Perl for a couple of weeks, and the tutorials I have seen have been unable to help me.

My problem is that my script chessy.pl currently only runs on unix manually, i type in ./chessy.pl 1 1 50 (where 1 1 50 are three seperate inputs to the script), now the script works and based on the 3 inputs the correct data is collected from a text file and output to another with just the results. I would like to run this script via a web browser, I have had a cgi-bin created and is accessbile via a webbrowser.

What i would like is a simple html form with 3 text boxes and a submit button, when i enter the data to the text files and press submit the script runs with the data provided.

In my actual script i have 3 parameters to hold the input data:

if($#ARGV == 2) { $input1 = $ARGV[0]; $input2 = $ARGV[1]; $input3 = $ARGV[2];
for the rest of the script it refers to these 3 parameters, so can anyone provide me a solution on how to run this script via a webpage rather than getting the script to read the parameters from the command line when the script is run.

Many thanks in advance

Chessy

update (broquaint): added formatting + title change (was Help a Perl Newbie)

Replies are listed 'Best First'.
Re: Help a Perl Newbie
by DamnDirtyApe (Curate) on Nov 28, 2002 at 01:52 UTC

    Take a look at the CGI module on CPAN, and specifically the param() function. It will allow you to provide information via a web form that you can then use in your script.


    _______________
    DamnDirtyApe
    Those who know that they are profound strive for clarity. Those who
    would like to seem profound to the crowd strive for obscurity.
                --Friedrich Nietzsche
Re: Help a Perl Newbie
by grantm (Parson) on Nov 28, 2002 at 04:04 UTC
    For a start, the form page can just be a static HTML file (not in cgi-bin) that has a form tag like this:
    <form action="/cgi-bin/yourscript.pl" method="GET">
    Later on, you might want to generate the form from the script (or you might not).