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
How to open a directory in perl?
What is the difference between use and require in perl programming?
What is perl programming?
Write syntax to use grep function?
Explain '->' in perl?
What is perl shift array function?
What is the difference between perl array and perl hash?
Remove the duplicate data from @array=(“perl”,”php”,”perl”,”asp”)
How would you ensure the re-use and maximum readability of your perl code?
Explain the difference between die and exit in perl?
Why do you use Perl?
What is cpan ? What are the modules coming under this?
How many types of primary data structures in Perl and what do they mean?
Differences between die and exit.
What is a chomp() function in perl?