Poppy Gerard said:
The name of the language is "Perl".
The name of the interpreter is "perl".
It is not an acronym.
perldoc -q difference
is the right way to do this - but I
am trying to generate a simple script that will run at a Website and
You want to write a "CGI program".
You can write a CGI program in just about any programming language
that you choose.
Many many people do happen to choose to use Perl for their CGI programs.
accept a numerical input typed in on the screen,
There is no "screen" in a CGI program.
A CGI program gets it input from the web server[1], and sends its
output to the web server[2].
and write the number
to a simple ASCII text file.
Does anyone know how one can do this with PERL, or is there a better /
easier way to generate such a program on-line?
People write programs.
Programs generate programs.
Their is no general purpose program-generator, you will need to
_write_ a program. To so that, you will need to learn a programming
language, perhaps Perl, perhaps anything else you might like.
If you chose to write that program using Perl, then it might
look something like this (untested):
----------------------------------------------
#!/usr/bin/perl
use strict;
use warnings;
use CGI qw/:standard/;
use CGI::Carp;
open FILE, '>simple_ASCII.txt' or
carp "could not open 'simple_ASCII.txt' $!";
print FILE param('the_number_from_the_form'), "\n";
close FILE or carp "problem closing file $!";
print "Content-Type: text/plain\n\n";
print param('the_number_from_the_form'), " has been written to the file\n";
----------------------------------------------
That's it!
(except a Real CGI Program would need to deal with multitasking and
do some form of file locking.
)
I would be grateful for any help / advice that people may be able to
offer.
There are a bazillion Perl FAQs about what you want to do, all you need
are some good search terms:
perldoc -q CGI
How can I make my CGI script more efficient?
Where can I learn about CGI or Web programming in Perl?
What is the correct form of response from a CGI script?
My CGI script runs from the command line but not the
browser. (500 Server Error)
How can I get better error messages from a CGI program?
How do I make sure users can't enter values into a form
that cause my CGI script to do bad things?
How do I decode a CGI form?
perldoc -q "\block"
How can I lock a file?
Why can't I just open(FH, ">file.lock")?
I still don't get locking. I just want to increment the
number in the file. How can I do this?
See also the Posting Guidelines that are posted here frequently.
[1] the web server in turn may have gotten the values from a <form>
filled out in a client program (eg. browser).
[2] the web server in turn may forward the output to a client program.