in reply to .cgi?action params

Please read I know what I mean. Why don't you?
Then read Short, Self-Contained, Correct Example.

That said, if you retrieve xxx.cgi?action=one&reaction=two, the following

#!/usr/bin/perl use CGI; my $query = CGI->new; my $action = $query->param('action'); my $reaction = $query->param('reaction'); print $query->header, $query->start_html, "<h1>Result</h1>\n", "Action: ", $action || "no action", "<br>", "Reaction: ", $reaction || "no reaction", $query->end_html;

will - if the webserver is correctly configured, if xxx.cgi has the correct permissions etc - serve a page reading:

Result

Action: one
Reaction: two

Now let me comment the snippets you posted.

my GetLink = 'one&reaction=two'; query string xxx.cgi?action=' + GetLink;

doesn't compile. Running that yields:

No such class GetLink at - line 1, near "my GetLink" syntax error at - line 1, near "my GetLink =" Can't find string terminator "'" anywhere before EOF at - line 2.

Then,

my $query = new CGI; my $action = lc ($query->param('action')); ....... elsif ($action eq "one"){ my ($string1, $string1 ) = @_; my ($string2, $string2 ) = @_; warn("string2 = '$string2'");

declaring a variable twice as in my ($string1,$string1) makes no sense at all. The special array @_ should only be used inside a subroutine and contains its arguments, if any. See perlvar and perlsub. Actually, don't see, read those pages.

Lastly,

elsif ($action eq "one"){ my $query = CGI->new(); my $string2 = $query->param('reaction'); warn("string2 = '$string2'");

here you are masking the outer $query with a new CGI object inside the elsif block. Why?

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Replies are listed 'Best First'.
Re^2: .cgi?action params
by tultalk (Monk) on May 28, 2017 at 15:44 UTC

    Hi. Thanks for input. All fixed now. As I seem to do, I do not post the actual code as it is part of a far larger operation which would just lead to confusion. This was screwed up. I did not copy and paste. I typed it anew with errors. You steered me in the correct direction . Again thanks. All turned out Ok.

      "As I seem to do, I do not post the actual code as it is part of a far larger operation which would just lead to confusion. This was screwed up. I did not copy and paste. I typed it anew with errors."

      Please don't do this, before posting run the code you claim to have a problem with, post the exact output as part of your problem. How do I post a question effectively?.

      Hello, tultalk. It's good to see you recognize that posting the whole hot mess of code was only going to add confusion. It's also good to see that you've realized that not posting actual code, data and results also confuses the issue.

      There is an additional hidden advantage to providing the oft-requested Short, Self-Contained, Correct Example:

      It forces you to restructure the problem. This often causes the mistake to reveal itself to you, as you suddenly toss out a handful of assumptions made whilst writing the original code.

      It's not only helpful in getting good answers from Perlmonks. It's also helpful in not needing to even ask for help.