facebook twitter youtube
in perl - 03 Feb, 2010, This Tutorial Has Been Viewed 12,999 Times.
by admin - no comments
How to get the query string value in perl cgi script
VN:F [1.9.22_1171]
Rating: 4.3/10 (3 votes cast)

In this tutorial we will see how to get the query string value using very simple perl CGI script.

When we hit a URL from the web browser with a query string say

http://mistonline.in/cgi/data.cgi?program=php

In which program=php is the query passed.Now we will see how we get the same value using perl CGI script.

Here is the code

  1. #!/usr/bin/perl
  2. #Script From Mistonline.in
  3. use strict;
  4. use CGI;
  5. my $cgi = new CGI;
  6. print
  7. $cgi->header() .
  8. $cgi->start_html( -title => Cgi Query String Results) .
  9. $cgi->h1(‘Values Passed’) . \n;
  10. my @params = $cgi->param();
  11. print ‘<table border=”1″ cellspacing=”0″ cellpadding=”0″>’ . \n;
  12. foreach my $parameter (sort @params) {
  13. print “<tr><th>$parameter</th><td>” . $cgi->param($parameter) . “</td></tr>\n;
  14. }
  15. print “</table>\n;
  16. print $cgi->end_html . \n;
  17. exit (0);
VN:F [1.9.22_1171]
Rating: 4.3/10 (3 votes cast)
How to get the query string value in perl cgi script, 4.3 out of 10 based on 3 ratings

Incoming search terms:




coded by nessus

Leave a Reply

Close
Please support the site
By clicking any of these buttons you help our site to get better