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 does a “grep” function perform?
Perl uses single or double quotes to surround a zero or more characters. Are the single(' ') or double quotes (" ") identical?
What does read () command do?
Explain which feature of PERL provides code reusability?
explain the various functions/directives in perl that allow you to include/import a module. Also, state the differences between them.
How to read multi lines from a file in perl?
Explain about typeglobs?
Explain string comparison operators in perl.
How to read file into hash array ?
what is Chop & Chomp function does?
Write syntax to add two arrays together in perl?
How the interpreter is used in Perl?
What syntax is used for grep() function?
Why should I use the -w argument with my Perl programs?
Explain split function in perl?