I have created a CGI-based page,after entering all the
values in to the fields, How to get the output on the web
browser using Perl

Answer Posted / vipul dalwala

print "content-type: text/html\n\n";.

if ($ENV{’REQUEST_METHOD’} eq ’POST’) {
read(STDIN, $buffer, $ENV{’CONTENT_LENGTH’});
}
else {
$buffer = $ENV{’QUERY_STRING’};
}

@keyvaluepairs = split(/&/, $buffer);

foreach $pair (@keyvaluepairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex
($1))/eg;
print $name . "=". $value ."<br>";
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write an example explaining the use of symbol tables.

564


What is the peculiarity of returning values by subroutines in perl?

486


Explain split function in perl?

562


How can the user execute a long command repeatedly without typing it again and again?

506


What exactly is grooving and shortening of the array?

592






How can I display all array element in which each element will display on next line in perl ?

482


What is the difference between die and exit in perl?

572


How do I read command-line arguments with Perl?

605


How to deleting an existing file in perl programming?

499


Explain perl.

555


What are the advantages of perl programming?

536


What is 'rollback' command in perl?

548


Write syntax to use grep function?

550


What is the importance of perl warnings?

539


What is Perl?

559