<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>BioGem.Org &#187; Perl/CGI</title>
	<atom:link href="http://www.biogem.org/tag/perlcgi/feed" rel="self" type="application/rss+xml" />
	<link>http://www.biogem.org</link>
	<description>Bioinformatics Blog Site..</description>
	<lastBuildDate>Sat, 03 Jul 2010 07:57:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Addition using Perl/CGI in Ubuntu</title>
		<link>http://www.biogem.org/2009/12/addition-using-perlcgi-in-ubuntu.html</link>
		<comments>http://www.biogem.org/2009/12/addition-using-perlcgi-in-ubuntu.html#comments</comments>
		<pubDate>Thu, 03 Dec 2009 03:26:03 +0000</pubDate>
		<dc:creator>Ashok Kumar</dc:creator>
				<category><![CDATA[Information Technology]]></category>
		<category><![CDATA[Addition]]></category>
		<category><![CDATA[Perl/CGI]]></category>

		<guid isPermaLink="false">http://www.biogem.org/?p=83</guid>
		<description><![CDATA[If Apache web server has installed in your system, you can run Perl/CGI script successfully. Create a html file and perl script using following steps.



Step 1: Creating a web page add.html
Open your console and type:
$ sudo gedit /var/www/add.html
Copy the lines below in the file and save it.

&#60;html&#62;
&#60;head&#62;
&#60;title&#62;Addition of two numbers.&#60;/title&#62;
&#60;/head&#62;
&#60;body&#62;
&#60;br&#62;&#60;br&#62;&#60;br&#62;&#60;br&#62;&#60;br&#62;
&#60;form action=&#8217;cgi-bin/add.pl&#8217; method=&#8217;post&#8217; enctype=&#8217;multipart/form_data&#8217;&#62;
&#60;table border=&#8217;0&#8242; align=&#8217;center&#8217;&#62;
&#60;tr&#62;&#60;td [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><span style="font-family: georgia,palatino;">If Apache web server has installed in your system, you can run Perl/CGI script successfully. Create a html file and perl script using following steps.</span></p>
<p><span id="more-83"></span></p>
<p style="text-align: justify;"><span style="font-family: georgia,palatino;"><br />
</span></p>
<p style="text-align: justify;"><span style="font-family: georgia,palatino;"><strong>Step 1:</strong> Creating a web page add.html</span></p>
<p style="text-align: justify;"><span style="font-family: georgia,palatino;">Open your console and type:</span></p>
<p style="text-align: justify;"><span style="color: #ff0000;">$ sudo gedit /var/www/add.html</span></p>
<p style="text-align: justify;"><span style="font-family: georgia,palatino;">Copy the lines below in the file and save it.<strong><br />
</strong></span></p>
<p style="text-align: justify;"><span style="color: #008000;">&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;Addition of two numbers.&lt;/title&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;<br />
&lt;form action=&#8217;cgi-bin/add.pl&#8217; method=&#8217;post&#8217; enctype=&#8217;multipart/form_data&#8217;&gt;<br />
&lt;table border=&#8217;0&#8242; align=&#8217;center&#8217;&gt;<br />
&lt;tr&gt;&lt;td colspan=&#8217;2&#8242; align=&#8217;center&#8217;&gt;<br />
&lt;b&gt;Adding Two Numbers&lt;/b&gt;<br />
&lt;/td&gt;&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;Enter the first value:&lt;/td&gt;<br />
&lt;td&gt;&lt;INPUT TYPE =&#8217;text&#8217; NAME=&#8217;n1&#8242;&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;<br />
&lt;td&gt;Enter the second value:&lt;/td&gt;<br />
&lt;td&gt;&lt;INPUT TYPE =&#8217;text&#8217; NAME=&#8217;n2&#8242;&gt;&lt;/td&gt;<br />
&lt;/tr&gt;<br />
&lt;tr&gt;&lt;td colspan=&#8217;2&#8242; align=&#8217;center&#8217;&gt;<br />
&lt;INPUT TYPE =&#8217;submit&#8217; VALUE=&#8217;ADD&#8217; NAME=&#8217;submit&#8217;&gt;<br />
&lt;/td&gt;&lt;/tr&gt;<br />
&lt;/table&gt;<br />
&lt;/form&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</span></p>
<p style="text-align: justify;"><span style="font-family: georgia,palatino;"><br />
</span></p>
<p style="text-align: justify;"><span style="font-family: georgia,palatino;"><strong>Step 2:</strong> Creating a perl script add.pl</span></p>
<p style="text-align: justify;"><span style="font-family: georgia,palatino;">Open your console and type:</span></p>
<p style="text-align: justify;"><span style="color: #ff0000;"> $ sudo gedit /usr/lib/cgi-bin/add.pl<br />
$ sudo chmod a+x /usr/lib/cgi-bin/add.pl</span></p>
<p style="text-align: justify;"><span style="font-family: georgia,palatino;">The command <span style="color: #ff0000;">chmod a+x</span><strong> </strong>is used to allow permission to run the script. Without using this command your program will not run. !!!</span></p>
<p style="text-align: justify;"><span style="font-family: georgia,palatino;">Copy the lines below in the file and save it.<strong><br />
</strong></span></p>
<p style="text-align: justify;"><span style="color: #008000;">#!/usr/bin/perl -w<br />
use CGI;<br />
CGI::ReadParse();<br />
$numb1 = $in{&#8217;n1&#8242;};<br />
chomp($numb1);<br />
$numb2 = $in{&#8217;n2&#8242;};<br />
chomp($numb2);<br />
$numb3=$numb1+$numb2;<br />
CGI::PrintHeader();<br />
print &#8220;content-type:text/html\n\n&#8221;;<br />
print &#8220;&lt;HTML&gt;\n&#8221;;<br />
print &#8220;&lt;head&gt;&lt;title&gt;Addition of two numbers&lt;/title&gt;&lt;/head&gt;\n&#8221;;<br />
print &#8220;&lt;body&gt;\n&#8221;;<br />
print &#8220;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;center&gt;Addition of $numb1 and $numb2 is $numb3.&lt;/center&gt;\n&#8221;;<br />
print &#8220;&lt;/body&gt;\n&#8221;;<br />
print &#8220;&lt;/html&gt;\n&#8221;;</span></p>
<p style="text-align: justify;"><span style="font-family: georgia,palatino;"><br />
</span></p>
<p style="text-align: justify;"><span style="font-family: georgia,palatino;"><strong>Step 3:</strong> Running the program</span></p>
<p style="text-align: justify;"><span style="font-family: georgia,palatino;">Open web browser and hit address <span style="color: #0000ff;"><a href="http://localhost/add.html">http://localhost/add.html</a></span> to run the Perl/CGI program.</span></p>
<p style="text-align: justify;"><span style="font-family: georgia,palatino;"><br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.biogem.org/2009/12/addition-using-perlcgi-in-ubuntu.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
