Beginner writing a text comparison cgi

S

SteevWatson

Hi
I have a very limited knowledge of perl so forgive me if this is a
stupid question or if it seems very basic. I'm trying to write code
that takes two texts submitted from an html form and compares them and
then displays the following. How may lines the texts have in common and
also lists each word in the texts as well as how may times they appear
in each text.

as i say I'm just a beginner so i hope this makes sense!

Cheers S
 
S

SteevWatson

Hi
I have a very limited knowledge of perl so forgive me if this is a
stupid question or if it seems very basic. I'm trying to write code
that takes two texts submitted from an html form and compares them and
then displays the following. How may lines the texts have in common and
also lists each word in the texts as well as how may times they appear
in each text.

as i say I'm just a beginner so i hope this makes sense!

Cheers S


Sorry i forgot to say i dont have a clue where to start. can somone
cive me some pointers or some code to work with?
 
T

Tad McClellan

(e-mail address removed) wrote:


If you show us what you have so far, we can help you fix and extend it.

that takes two texts submitted from an html form
[snip]

Sorry i forgot to say i dont have a clue where to start.


Start with writing a program that can get 2 texts submitted from an html form.

Then write a program that can compare the 2 texts taken from the form.

Then write a program that counts when the texts compare equally.

Then...

can somone
cive me some pointers or some code to work with?

Here is the first program mentioned above (untested):

use CGI qw/:standard/;
my $text1 = param('text1');
my $text2 = param('text2');
print "I have gotten '$text1' and '$text2'\n";

Here is the second one:

use CGI qw/:standard/;
my $text1 = param('text1');
my $text2 = param('text2');
print "'$text1' and '$text2' are equal\n" if $text1 eq $text2;


You almost certainly could have gotten that far had you tried...
 
S

SteevWatson

Tad said:
(e-mail address removed) wrote:


If you show us what you have so far, we can help you fix and extend it.

that takes two texts submitted from an html form
[snip]

Sorry i forgot to say i dont have a clue where to start.


Start with writing a program that can get 2 texts submitted from an html form.

Then write a program that can compare the 2 texts taken from the form.

Then write a program that counts when the texts compare equally.

Then...

can somone
cive me some pointers or some code to work with?

Here is the first program mentioned above (untested):

use CGI qw/:standard/;
my $text1 = param('text1');
my $text2 = param('text2');
print "I have gotten '$text1' and '$text2'\n";

Here is the second one:

use CGI qw/:standard/;
my $text1 = param('text1');
my $text2 = param('text2');
print "'$text1' and '$text2' are equal\n" if $text1 eq $text2;


You almost certainly could have gotten that far had you tried...


Thanks I do have some code and its simmilar to yours but mine wont run.
Im posting from my phone on the way home so i'll post my code tomorrow
morning aswell as try yours.

cheers c
 
S

SteevWatson

Tad said:
(e-mail address removed) wrote:


If you show us what you have so far, we can help you fix and extend it.

that takes two texts submitted from an html form
[snip]

Sorry i forgot to say i dont have a clue where to start.


Start with writing a program that can get 2 texts submitted from an html form.

Then write a program that can compare the 2 texts taken from the form.

Then write a program that counts when the texts compare equally.

Then...

can somone
cive me some pointers or some code to work with?

Here is the first program mentioned above (untested):

use CGI qw/:standard/;
my $text1 = param('text1');
my $text2 = param('text2');
print "I have gotten '$text1' and '$text2'\n";

Here is the second one:

use CGI qw/:standard/;
my $text1 = param('text1');
my $text2 = param('text2');
print "'$text1' and '$text2' are equal\n" if $text1 eq $text2;


You almost certainly could have gotten that far had you tried...


Thanks I do have some code and its simmilar to yours but mine wont run.
Im posting from my phone on the way home so i'll post my code tomorrow
morning aswell as try yours.

cheers c
 
M

Mumia W. (on aioe)


Thescripts.com is a completely different forum from clpm. There is no
reason to suspect that a significant portion of readers of clpm also
read thescripts.com.

Asking a question on both clpm and thescripts.com is like asking a
lawyer for an opinion then getting a second opinion from another lawyer.

I can see where some people think that posting the same thing on usenet
twice in different groups is rude, but saying that someone can't post
the same thing in two different places anywhere on the Internet doesn't
make any sense to me.
 
M

Michele Dondi

rOn Fri, 15 Dec 2006 01:01:37 -0600, "Mumia W. (on aioe)"
Asking a question on both clpm and thescripts.com is like asking a
lawyer for an opinion then getting a second opinion from another lawyer.

Yet it would be fine to point out having done so, and possibly report
to any of the resources interesting info got from the other one...


Michele
 
G

Gunnar Hjalmarsson

Mumia said:
Thescripts.com is a completely different forum from clpm. There is no
reason to suspect that a significant portion of readers of clpm also
read thescripts.com.

I agree. But how would that justify multi-posting? On the contrary, just
that fact increases the risk that somebody here spend time on an answer
without knowing that the problem already was resolved over there (or
vice versa).

The OP's explanation at thescripts.com:
"I posted in multiple forms because different people visit different
forums and I want as much help as i can get."
reveals an inconsiderate view on how to (ab)use the free resources for
seeking help with Perl.
Asking a question on both clpm and thescripts.com is like asking a
lawyer for an opinion then getting a second opinion from another lawyer.

There is a huge difference: The person who asks two lawyers for advice
get two bills, i.e. s/he pays for the services.
I can see where some people think that posting the same thing on usenet
twice in different groups is rude, but saying that someone can't post
the same thing in two different places anywhere on the Internet doesn't
make any sense to me.

Please allow me to disagree. The OP took the point and apologised, so I
was kind of surprised to see you defend him. ;-)
 
B

brian d foy

Sorry I didnt realise this war rude.

Usually it's enough to just say where you've also asked this question
and to provide a link to it. That way someone doesn't spend a lot of
time typing an answer that you've already received elsewhere.

To be extra nice, you can go back to the places you posted and provide
links to the answers you got elsewhere.

Good luck :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top