<?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>Perl Script Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/category/programming-scripting-languages/perl-script/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/category/programming-scripting-languages/perl-script/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Sat, 27 Feb 2021 09:18:05 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>Remove Control ^M from files</title>
		<link>https://www.scmgalaxy.com/tutorials/remove-control-m-from-files/</link>
					<comments>https://www.scmgalaxy.com/tutorials/remove-control-m-from-files/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 12:57:21 +0000</pubDate>
				<category><![CDATA[Perl Script]]></category>
		<category><![CDATA[files]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2523</guid>

					<description><![CDATA[<p>tpatil created the topic: Remove Control ^M from files Single file method perl -pi -e "s/\r//" filename.txt Multiple File Method [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/remove-control-m-from-files/">Remove Control ^M from files</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>tpatil created the topic: Remove Control ^M from files</strong></p>
<p>Single file method</p>
<p><code>perl -pi -e "s/\r//" filename.txt</code></p>
<p>Multiple File Method</p>
<p><code>find . -type f -exec perl -pi -e "s/\r//" {} \;</code></p>
<p><strong>rajeshkumar replied the topic: Re:Remove Control ^M from files</strong><br />
I used to do in shell using following command</p>
<p>> 1,$s/^M//g</p>
<p>Correct me if I am wrong<br />
Regards,<br />
Rajesh Kumar<br />
Twitt me @ <strong>twitter.com/RajeshKumarIn</strong></p>
<p><strong>tpatil replied the topic: Re:Remove Control ^M from files</strong></p>
<p>Yes, this is also correct command if you want to remove ^M from single file in VI edit mode.</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/remove-control-m-from-files/">Remove Control ^M from files</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/remove-control-m-from-files/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>I need to a perl script</title>
		<link>https://www.scmgalaxy.com/tutorials/i-need-to-a-perl-script/</link>
					<comments>https://www.scmgalaxy.com/tutorials/i-need-to-a-perl-script/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 12:53:41 +0000</pubDate>
				<category><![CDATA[Perl Script]]></category>
		<category><![CDATA[Perl]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2521</guid>

					<description><![CDATA[<p>rajeshkumar created the topic: i need to a perl script Hi , There is a file called test.txt what are [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/i-need-to-a-perl-script/">I need to a perl script</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>rajeshkumar created the topic: i need to a perl script</strong><br />
Hi ,</p>
<p>There is a file called test.txt what are all the different ways</p>
<p>BEGIN:<br />
test 1<br />
test 2 %%%%%%%%%% TEST TEST TEST<br />
test 3<br />
END:</p>
<p>need to grab all contents in between BEGIN and END:<br />
Regards,<br />
Rajesh Kumar<br />
Twitt me @ <a href="http://twitter.com/RajeshKumarIn">twitter.com/RajeshKumarIn</a></p>
<p><strong>rajeshkumar replied the topic: Re:i need to a perl script</strong></p>
<p>Solution could be &#8230;..</p>
<p><code>#!/usr/bin/perl -w<br />
$file=open(f, "test.txt");<br />
$str="";<br />
while(<f>) {$str.=$_;}<br />
close(f);<br />
$str =~ s/BEGIN:(.*)END:/$1/egs;<br />
print $str</code></p>
<p>Regards,<br />
Rajesh Kumar<br />
Twitt me @ <a href="http://twitter.com/RajeshKumarIn">twitter.com/RajeshKumarIn</a></p>
<p><strong>venu.madhav48@gmail.com replied the topic: Re:i need to a perl script</strong></p>
<p>Please answer the below questions</p>
<p>1.What standard Perl modules have you made use of, and why did you use them instead of the equivalent built-in functions?</p>
<p>2.Write a statement that checks to make sure there are at least two command line arguments and exits with an error if not.</p>
<p>3.How do you find the number of elements in an array?</p>
<p>4.When an array is defined, PERL automatically numbers each element in the array<br />
beginning with zero</p>
<p><strong>venu.madhav48@gmail.com replied the topic: Re:i need to a perl script</strong><br />
Dear Rajesh,</p>
<p>Can u please help in answering the above questions</p>
<p><strong>rajeshkumar replied the topic: Re:i need to a perl script</strong></p>
<p>Hi Venu,</p>
<p>i will post this solution today evening&#8230;<br />
Regards,<br />
Rajesh Kumar<br />
Twitt me @<a href="http://twitter.com/RajeshKumarIn"> twitter.com/RajeshKumarIn</a></p>
<p><strong>venu.madhav48@gmail.com replied the topic: Re:i need to a perl script</strong><br />
Waiting for your post&#8230;.</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/i-need-to-a-perl-script/">I need to a perl script</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/i-need-to-a-perl-script/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>The difference between my and local</title>
		<link>https://www.scmgalaxy.com/tutorials/the-difference-between-my-and-local/</link>
					<comments>https://www.scmgalaxy.com/tutorials/the-difference-between-my-and-local/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 12:43:10 +0000</pubDate>
				<category><![CDATA[Perl Script]]></category>
		<category><![CDATA[local]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2517</guid>

					<description><![CDATA[<p>rajeshkumar created the topic: The difference between my and local There is a subtle difference. In the example below, $::a [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/the-difference-between-my-and-local/">The difference between my and local</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>rajeshkumar created the topic: The difference between my and local</strong></p>
<p>There is a subtle difference.</p>
<p>In the example below, $::a refers to $a in the &#8216;global&#8217; namespace.<br />
&#8216;local&#8217; temporarily changes the value of the variable, but only within the scope it exists in.<br />
$a = 3.14159;<br />
{<br />
	local $a = 3;<br />
	print &#8220;In block, \$a = $a\n&#8221;;<br />
	print &#8220;In block, \$::a = $::a\n&#8221;;<br />
} </p>
<p>print &#8220;Outside block, \$a = $a\n&#8221;;<br />
print &#8220;Outside block, \$::a = $::a\n&#8221;;</p>
<p># This outputs In block,</p>
<p># This outputs<br />
In block, $a = 3<br />
In block, $::a = 3<br />
Outside block, $a = 3.14159<br />
Outside block, $::a = 3.14159</p>
<p>&#8216;my&#8217; has no effect on the global $a, even inside the block. </p>
<p>$a = 3.14159;<br />
{<br />
my $a = 3;<br />
print &#8220;In block, \$a = $a\n&#8221;;<br />
print &#8220;In block, \$::a = $::a\n&#8221;;<br />
}<br />
print &#8220;Outside block, \$a = $a\n&#8221;;<br />
print &#8220;Outside block, \$::a = $::a\n&#8221;;</p>
<p># This outputs<br />
In block, $a = 3<br />
In block, $::a = 3.14159<br />
Outside block, $a = 3.14159<br />
Outside block, $::a = 3.14159</p>
<p>Regards,<br />
Rajesh Kumar<br />
Twitt me @ <a href="http://twitter.com/RajeshKumarIn">twitter.com/RajeshKumarIn</a></p>
<p><strong>scmuser replied the topic: Re: The difference between my and local</strong></p>
<p>With more explanation&#8230;</p>
<p>Both of them are used to declare local variables.<br />
The variables declared with &#8220;my&#8221; can live only within the block it was defined and cannot get its visibility inherited functions called within that block, but one defined with &#8220;local&#8221; can live within the block and have its visibility in the functions called within that block.</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/the-difference-between-my-and-local/">The difference between my and local</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/the-difference-between-my-and-local/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What is the meaning of rigging?</title>
		<link>https://www.scmgalaxy.com/tutorials/what-is-the-meaning-of-rigging/</link>
					<comments>https://www.scmgalaxy.com/tutorials/what-is-the-meaning-of-rigging/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 12:41:27 +0000</pubDate>
				<category><![CDATA[Perl Script]]></category>
		<category><![CDATA[rigging]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2515</guid>

					<description><![CDATA[<p>scmuser created the topic: What is the meaning of rigging? Hi, Could you please tell me meaning of rigging in [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/what-is-the-meaning-of-rigging/">What is the meaning of rigging?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>scmuser created the topic: What is the meaning of rigging?</strong><br />
Hi,</p>
<p>Could you please tell me meaning of rigging in perl?</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/what-is-the-meaning-of-rigging/">What is the meaning of rigging?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/what-is-the-meaning-of-rigging/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Parenthesis After Module Name And Without Parenths</title>
		<link>https://www.scmgalaxy.com/tutorials/parenthesis-after-module-name-and-without-parenths/</link>
					<comments>https://www.scmgalaxy.com/tutorials/parenthesis-after-module-name-and-without-parenths/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 12:36:08 +0000</pubDate>
				<category><![CDATA[Perl Script]]></category>
		<category><![CDATA[Module]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2513</guid>

					<description><![CDATA[<p>scmuser created the topic: parenthesis after module name and without parenths What is the difference between having a parenthesis after [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/parenthesis-after-module-name-and-without-parenths/">Parenthesis After Module Name And Without Parenths</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>scmuser created the topic: parenthesis after module name and without parenths</strong></p>
<p>What is the difference between having a parenthesis after module name and without parenthsis after module name?? i.e</p>
<p><code>Package::Module();</code></p>
<p><code>Package::Module;</code></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/parenthesis-after-module-name-and-without-parenths/">Parenthesis After Module Name And Without Parenths</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/parenthesis-after-module-name-and-without-parenths/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Question Regarding to Eval Function</title>
		<link>https://www.scmgalaxy.com/tutorials/question-regarding-to-eval-function/</link>
					<comments>https://www.scmgalaxy.com/tutorials/question-regarding-to-eval-function/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 12:32:25 +0000</pubDate>
				<category><![CDATA[Perl Script]]></category>
		<category><![CDATA[Eval]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2511</guid>

					<description><![CDATA[<p>scmuser created the topic: question regarding to eval function I have one question regarding to eval function. I know eval [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/question-regarding-to-eval-function/">Question Regarding to Eval Function</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>scmuser created the topic: question regarding to eval function</strong></p>
<p>I have one question regarding to eval function. I know eval function is use for error checking but I am not able to understand below line.</p>
<p><code>eval \'exec perl -S $0 ${1+\"$@\"}\' if 0; $0</code></p>
<p>for script name $@ set if error occur</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/question-regarding-to-eval-function/">Question Regarding to Eval Function</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/question-regarding-to-eval-function/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Find a particular word in a paragraph</title>
		<link>https://www.scmgalaxy.com/tutorials/find-a-particular-word-in-a-paragraph/</link>
					<comments>https://www.scmgalaxy.com/tutorials/find-a-particular-word-in-a-paragraph/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 12:29:45 +0000</pubDate>
				<category><![CDATA[Perl Script]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2509</guid>

					<description><![CDATA[<p>scmuser created the topic: Find a particular word in a paragraph Write a Perl script to find a particular word [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/find-a-particular-word-in-a-paragraph/">Find a particular word in a paragraph</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>scmuser created the topic: Find a particular word in a paragraph</strong></p>
<p>Write a Perl script to find a particular word in a paragraph???</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/find-a-particular-word-in-a-paragraph/">Find a particular word in a paragraph</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/find-a-particular-word-in-a-paragraph/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Create a flat file database using perl</title>
		<link>https://www.scmgalaxy.com/tutorials/create-a-flat-file-database-using-perl/</link>
					<comments>https://www.scmgalaxy.com/tutorials/create-a-flat-file-database-using-perl/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 12:27:48 +0000</pubDate>
				<category><![CDATA[Perl Script]]></category>
		<category><![CDATA[Perl]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2507</guid>

					<description><![CDATA[<p>scmuser created the topic: Create a flat file database using perl How to create a flat file database as shown [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/create-a-flat-file-database-using-perl/">Create a flat file database using perl</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>scmuser created the topic: Create a flat file database using perl</strong></p>
<p>How to create a flat file database as shown below</p>
<p>s.no name age city phone<br />
0 hema 22 Calcutta 4312542<br />
1 hema 21 Bangalore 2344345<br />
2 ganesh 25 delhi 2445454<br />
3 kartik 45 pune 4312121<br />
4 santosh 25 Hyderabad 2254231<br />
5 kumar 25 mysore 2344567<br />
6 gita 34 mangalore 6532123<br />
7 gita 32 pune 2213456</p>
<p>Q1.print the details of the person who r from bangalore</p>
<p>Q2.Replace the city name managlore to pune</p>
<p>Q3.prints no of person having name gita and hema</p>
<p>Q4.print how many are of age 25</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/create-a-flat-file-database-using-perl/">Create a flat file database using perl</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/create-a-flat-file-database-using-perl/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Find whether a given line of text is starting and</title>
		<link>https://www.scmgalaxy.com/tutorials/find-whether-a-given-line-of-text-is-starting-and/</link>
					<comments>https://www.scmgalaxy.com/tutorials/find-whether-a-given-line-of-text-is-starting-and/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 12:24:31 +0000</pubDate>
				<category><![CDATA[Perl Script]]></category>
		<category><![CDATA[Perl]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2505</guid>

					<description><![CDATA[<p>scmuser created the topic: Find whether a given line of text is starting and Write a perl script to find [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/find-whether-a-given-line-of-text-is-starting-and/">Find whether a given line of text is starting and</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>scmuser created the topic: Find whether a given line of text is starting and</strong></p>
<p>Write a perl script to find whether a given line of text is starting and ending with same word or not ???</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/find-whether-a-given-line-of-text-is-starting-and/">Find whether a given line of text is starting and</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/find-whether-a-given-line-of-text-is-starting-and/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Use Vs require in perl</title>
		<link>https://www.scmgalaxy.com/tutorials/use-vs-require-in-perl/</link>
					<comments>https://www.scmgalaxy.com/tutorials/use-vs-require-in-perl/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 12:22:27 +0000</pubDate>
				<category><![CDATA[Perl Script]]></category>
		<category><![CDATA[Perl]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2503</guid>

					<description><![CDATA[<p>scmuser created the topic: use Vs require in perl Hi, Whats difference between &#8220;use&#8221; and &#8220;require&#8221; in perl? rajeshkumar replied [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/use-vs-require-in-perl/">Use Vs require in perl</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>scmuser created the topic: use Vs require in perl</strong></p>
<p>Hi,</p>
<p>Whats difference between &#8220;use&#8221; and &#8220;require&#8221; in perl?</p>
<p><strong>rajeshkumar replied the topic: Re: use Vs require in perl</strong></p>
<p>use is done at ‘compile-time’ and require is done at ‘run-time’ (ie can conditionally load modules)</p>
<p>Regards,<br />
Rajesh Kumar<br />
Twitt me @ <a href="http://twitter.com/RajeshKumarIn">twitter.com/RajeshKumarIn</a></p>
<p><strong>rajeshkumar replied the topic: Re: use Vs require in perl</strong><br />
More&#8230;</p>
<p>use is a pre-built in function in perl to Imports some semantics into the current package from the named module, generally by aliasing certain subroutine or variable names into your package such as..</p>
<p>* use Module VERSION LIST</p>
<p>* use Module VERSION<br />
* use Module LIST<br />
* use Module<br />
* use VERSION</p>
<p>More info.. <a href="http://perldoc.perl.org/functions/use.html">perldoc.perl.org/functions/use.html</a></p>
<p>Regards,<br />
Rajesh Kumar<br />
Twitt me @ <a href="http://twitter.com/RajeshKumarIn">twitter.com/RajeshKumarIn</a></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/use-vs-require-in-perl/">Use Vs require in perl</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/use-vs-require-in-perl/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Spit out warnings on uninitialized variables Perl</title>
		<link>https://www.scmgalaxy.com/tutorials/spit-out-warnings-on-uninitialized-variables-perl/</link>
					<comments>https://www.scmgalaxy.com/tutorials/spit-out-warnings-on-uninitialized-variables-perl/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 12:17:24 +0000</pubDate>
				<category><![CDATA[Perl Script]]></category>
		<category><![CDATA[Perl]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2501</guid>

					<description><![CDATA[<p>scmuser created the topic: Spit out warnings on uninitialized variables Perl How to Spit out warnings on uninitialized variables in [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/spit-out-warnings-on-uninitialized-variables-perl/">Spit out warnings on uninitialized variables Perl</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>scmuser created the topic: Spit out warnings on uninitialized variables Perl</strong></p>
<p>How to Spit out warnings on uninitialized variables in Perl?</p>
<p><strong>rajeshkumar replied the topic: Re: Spit out warnings on uninitialized variables Perl</strong></p>
<p><code>#!/usr/local/bin/perl -w</code></p>
<p>This will help you (really, it will force you) to write better, cleaner code. Adding the -w switch to the perl interpreter will cause it to spit out warnings on uninitialized variables &#8211; potential bugs.</p>
<p>Regards,<br />
Rajesh Kumar<br />
Twitt me @ <a href="http://twitter.com/RajeshKumarIn">twitter.com/RajeshKumarIn</a></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/spit-out-warnings-on-uninitialized-variables-perl/">Spit out warnings on uninitialized variables Perl</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/spit-out-warnings-on-uninitialized-variables-perl/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Installing Perl modules</title>
		<link>https://www.scmgalaxy.com/tutorials/installing-perl-modules/</link>
					<comments>https://www.scmgalaxy.com/tutorials/installing-perl-modules/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 12:15:01 +0000</pubDate>
				<category><![CDATA[Perl Script]]></category>
		<category><![CDATA[Perl]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2499</guid>

					<description><![CDATA[<p>rajeshkumar created the topic: Installing Perl modules Perl modules may be installed using the CPAN module or from source. CPAN [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/installing-perl-modules/">Installing Perl modules</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>rajeshkumar created the topic: Installing Perl modules</strong></p>
<p>Perl modules may be installed using the CPAN module or from source.<br />
CPAN method</p>
<p>perl -MCPAN -e shell (to get an interactive CPAN shell)<br />
perl -MCPAN -e &#8216;install Time::JulianDay&#8217; (if you know the name of the module, you can install it directly without interacting with the CPAN shell)</p>
<p>Within the CPAN shell:<br />
i /expression/ will search for a Perl module containing expression, and<br />
install module will install the module.</p>
<p>Example:<br />
perl -MCPAN -e shell<br />
i /JulianDay/<br />
install Time::JulianDay</p>
<p>Note: if you are behind a firewall, you may wish to use passive FTP with Perl&#8217;s Net::FTP module. Set the environment variable FTP_PASSIVE 1 (or any non-zero value) to use passive FTP when downloading Perl modules through CPAN.</p>
<p>Manual installation</p>
<p>To manually install a Perl module:</p>
<p>1. Download the Perl module from CPAN or other site.<br />
2. Extract the tarball.<br />
3. Run perl Makefile.PL<br />
4. Run make<br />
5. Run make test<br />
6. Run make install</p>
<p>Note: you should use the same compiler to build Perl modules that you used to build Perl. For example, if you are building Perl modules with gcc and are using a version of Perl that was supplied with your distribution (ex. Solaris 8 includes Perl 5.005_03), you may run into errors.</p>
<p>Checking for existence of a Perl module<br />
An easy way to check for the existence of a Perl module on your system (technically, in Perl&#8217;s @INC array, a list of directories Perl searches when attempting to load modules) is to run perl -e &#8216;use module;&#8217;</p>
<p>Example:</p>
<p>perl -e &#8216;use HTML::Parser;&#8217;</p>
<p>Regards,<br />
Rajesh Kumar<br />
Twitt me @ <a href="http://twitter.com/RajeshKumarIn">twitter.com/RajeshKumarIn</a></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/installing-perl-modules/">Installing Perl modules</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/installing-perl-modules/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Access denied for user &#8216;ODBC&#8217;@&#8217;localhost</title>
		<link>https://www.scmgalaxy.com/tutorials/access-denied-for-user-odbclocalhost/</link>
					<comments>https://www.scmgalaxy.com/tutorials/access-denied-for-user-odbclocalhost/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 12:13:10 +0000</pubDate>
				<category><![CDATA[Perl Script]]></category>
		<category><![CDATA[ODBC]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2497</guid>

					<description><![CDATA[<p>rajeshkumar created the topic: Access denied for user &#8216;ODBC&#8217;@&#8217;localhost I am getting following error while running following command&#8230;any help > [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/access-denied-for-user-odbclocalhost/">Access denied for user &#8216;ODBC&#8217;@&#8217;localhost</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>rajeshkumar created the topic: Access denied for user &#8216;ODBC&#8217;@&#8217;localhost</strong></p>
<p>I am getting following error while running following command&#8230;any help</p>
<p><code>> perl -MCPAN -e "install DBD::mysql";</code></p>
<p>Error</p>
<p><code>D:\wamp\bin\mysql\MYSQL5~1.36\bin\MYSQLA~1.EXE: connect to server at 'localhost'<br />
 failed<br />
error: 'Access denied for user 'ODBC'@'localhost' (using password: NO)'<br />
Problem running D:\wamp\bin\mysql\MYSQL5~1.36\bin\MYSQLA~1.EXE - aborting ...</code></p>
<p>Regards,<br />
Rajesh Kumar<br />
Twitt me @ <a href="http://twitter.com/RajeshKumarIn">twitter.com/RajeshKumarIn</a></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/access-denied-for-user-odbclocalhost/">Access denied for user &#8216;ODBC&#8217;@&#8217;localhost</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/access-denied-for-user-odbclocalhost/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Perl -MCPAN -e &#8220;install DBD::mysql&#8221;</title>
		<link>https://www.scmgalaxy.com/tutorials/perl-mcpan-e-install-dbdmysql/</link>
					<comments>https://www.scmgalaxy.com/tutorials/perl-mcpan-e-install-dbdmysql/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 12:01:38 +0000</pubDate>
				<category><![CDATA[Perl Script]]></category>
		<category><![CDATA[Perl]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2493</guid>

					<description><![CDATA[<p>rajeshkumar created the topic: perl -MCPAN -e &#8220;install DBD::mysql&#8221; I am getting following issues while running following command in Windows [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/perl-mcpan-e-install-dbdmysql/">Perl -MCPAN -e &#8220;install DBD::mysql&#8221;</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>rajeshkumar created the topic: perl -MCPAN -e &#8220;install DBD::mysql&#8221;</strong></p>
<p>I am getting following issues while running following command in Windows Machine&#8230;</p>
<p><code>perl -MCPAN -e "install DBD::mysql"</code></p>
<p>Error</p>
<p>Regards,<br />
Rajesh Kumar<br />
Twitt me @ <a href="http://twitter.com/RajeshKumarIn">twitter.com/RajeshKumarIn</a></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/perl-mcpan-e-install-dbdmysql/">Perl -MCPAN -e &#8220;install DBD::mysql&#8221;</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/perl-mcpan-e-install-dbdmysql/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Use of use DBI;</title>
		<link>https://www.scmgalaxy.com/tutorials/use-of-use-dbi/</link>
					<comments>https://www.scmgalaxy.com/tutorials/use-of-use-dbi/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 11:59:10 +0000</pubDate>
				<category><![CDATA[Perl Script]]></category>
		<category><![CDATA[DBI]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2491</guid>

					<description><![CDATA[<p>scmuser created the topic: Use of use DBI; Hi, why do we use following syntax in perl program. can you [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/use-of-use-dbi/">Use of use DBI;</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>scmuser created the topic: Use of use DBI;</strong></p>
<p>Hi,</p>
<p>why do we use following syntax in perl program. can you please explain it?</p>
<p><code>use DBI;</code></p>
<p><strong>rajeshkumar replied the topic: Re: Use of use DBI;</strong></p>
<p>Perl&#8217;s coolest modules is the Perl database interface (DBI). This module offers a unified interface to different databases, providing a series of generic functions that are internally translated into native function calls. This makes it extremely easy to take advantage of a database and create dynamic Web pages using Perl.</p>
<p>Download and install</p>
<p>To begin, download and install the Perl DBI module and the MySQL DBD driver by running the following commands at your Perl prompt:</p>
<p><code>perl> perl -MCPAN -e "install DBI"<br />
perl> perl -MCPAN -e "install DBD::mysql"</code></p>
<p>PERL &#8211; DBI Query</p>
<p>Queries must be prepared and then executed. Two lines of code are required for this, first the prepare() function and then the execute() function.</p>
<p>PERL &#8211; DBI Prepare()</p>
<p>Inside the prepare() function lies the actual SQL query. Essentially the prepare function acts precisely like the console of an SQL platform. If you&#8217;ve been following along, all we need to do is define a variable with a(n) SQL statement. Then create a query handle and run our $connect statement along with the prepare function as outlined below.</p>
<p>The only main difference is that we have to use PERL&#8217;s escaping characters and we probably have to use them more often.</p>
<p>PERL &#8211; DBI Execute<br />
Once the query has been prepared, we must execute the command with the execute function. This is accomplished in one final line appended to the code above.</p>
<p>PERL &#8211; DBI Select Queries<br />
Select queries fetch results and then return those results in the form of an array. Accessing the results of the array requires first that we bind the columns to variable names. Then we just need to set up a loop to loop through each row and print back the results to our browser.</p>
<p><code>#!/usr/bin/perl</p>
<p># PERL MODULES WE WILL BE USING<br />
use DBI;<br />
use DBD::mysql;</p>
<p># HTTP HEADER<br />
print "Content-type: text/html \n\n";</p>
<p># CONFIG VARIABLES<br />
$platform = "mysql";<br />
$database = "store";<br />
$host = "localhost";<br />
$port = "3306";<br />
$tablename = "inventory";<br />
$user = "username";<br />
$pw = "password";</p>
<p># DATA SOURCE NAME<br />
$dsn = "dbi:mysql:$database:localhost:3306";</p>
<p># PERL DBI CONNECT<br />
$connect = DBI->connect($dsn, $user, $pw);</p>
<p># PREPARE THE QUERY<br />
$query = "SELECT * FROM inventory ORDER BY id";<br />
$query_handle = $connect->prepare($query);</p>
<p># EXECUTE THE QUERY<br />
$query_handle->execute();</p>
<p># BIND TABLE COLUMNS TO VARIABLES<br />
$query_handle->bind_columns(undef, \$id, \$product, \$quantity);</p>
<p># LOOP THROUGH RESULTS<br />
while($query_handle->fetch()) {<br />
   print "$id, $product, $quantity <br />";<br />
}</code></p>
<p>Regards,<br />
Rajesh Kumar<br />
Twitt me @ <a href="http://twitter.com/RajeshKumarIn">twitter.com/RajeshKumarIn</a></p>
<p><strong>rajeshkumar replied the topic: Re: Use of use DBI;</strong></p>
<p>One more example for connecting database using perl</p>
<p>You can connect to MySQL database from a Perl script using the Perl DBI module. DBI stands for “Database Interface” and is a database layer, with simple interface for SQL queries. Here is a Perl script connecting to MySQL database and printing FirstName and LastName columns from a table called Users:<br />
#!/usr/local/bin/perl</p>
<p>use DBI;</p>
<p>print &#8220;Content-type:text/html\n\n&#8221;;</p>
<p>$dbh = DBI->connect(&#8220;dbi:mysql:database=; host=localhost; user=; password=&#8221;)<br />
    or die &#8220;Connecting from PHP to MySQL database failed: $DBI::errstr&#8221;;</p>
<p>$sSQL = &#8220;SELECT FirstName, LastName FROM Users&#8221;;<br />
$st = $dbh->prepare($sSQL)<br />
    or die &#8220;Preparing MySQL query failed: $DBI::errstr<br />
&#8220;;</p>
<p>$st->execute()<br />
    or die &#8220;The execution of the MySQL query failed: $DBI::errstr&#8221;;</p>
<p>while ($row = $st->fetchrow_hashref())<br />
{<br />
    print &#8221; $row->{FirstName} $row->{LastName}<br />
&#8220;;<br />
}</p>
<p>$dbh ->disconnect();</p>
<p>Regards,<br />
Rajesh Kumar<br />
Twitt me @ <a href="http://twitter.com/RajeshKumarIn">twitter.com/RajeshKumarIn</a></p>
<p><strong>rajeshkumar replied the topic: Re: Use of use DBI;</strong></p>
<p>One more example&#8230;</p>
<p><code>#!/usr/bin/perl<br />
use DBI;</p>
<p>$database = "DBNAME";<br />
$hostname = "DBSERVER";<br />
$port = "3306";<br />
$username = "DBUSERNAME";<br />
$password = 'DBPASSWORD';</p>
<p>$dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";</p>
<p>$dbh = DBI->connect($dsn, $username, $password) or die("Could not connect!");</p>
<p>$sql = "SELECT * FROM mytable";</p>
<p>$sth = $dbh->prepare($sql);<br />
$sth->execute;</p>
<p>while(($column1, $column2) = $sth->fetchrow_array)<br />
{<br />
print "C1 = $column1, C2 = $column2n";<br />
}</p>
<p>$dbh->disconnect;</code></p>
<p>where DBNAME, DBUSERNAME, and DBPASSWORD are your database name, database username and database password, and where DBSERVER is your database server.</p>
<p>Regards,<br />
Rajesh Kumar<br />
Twitt me @ <a href="http://twitter.com/RajeshKumarIn">twitter.com/RajeshKumarIn</a></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/use-of-use-dbi/">Use of use DBI;</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/use-of-use-dbi/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Connect to my MySQL database using Perl?</title>
		<link>https://www.scmgalaxy.com/tutorials/connect-to-my-mysql-database-using-perl/</link>
					<comments>https://www.scmgalaxy.com/tutorials/connect-to-my-mysql-database-using-perl/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 11:37:20 +0000</pubDate>
				<category><![CDATA[Perl Script]]></category>
		<category><![CDATA[Perl]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2489</guid>

					<description><![CDATA[<p>rajeshkumar created the topic: connect to my MySQL database using Perl? #!/usr/bin/perl use DBI; $database = &#8220;DBNAME&#8221;; $hostname = &#8220;DBSERVER&#8221;; [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/connect-to-my-mysql-database-using-perl/">Connect to my MySQL database using Perl?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>rajeshkumar created the topic: connect to my MySQL database using Perl?</strong></p>
<p>#!/usr/bin/perl<br />
use DBI;</p>
<p>$database = &#8220;DBNAME&#8221;;<br />
$hostname = &#8220;DBSERVER&#8221;;<br />
$port = &#8220;3306&#8221;;<br />
$username = &#8220;DBUSERNAME&#8221;;<br />
$password = &#8216;DBPASSWORD&#8217;;</p>
<p>$dsn = &#8220;DBI:mysql:database=$database;host=$hostname;port=$port&#8221;;</p>
<p>$dbh = DBI->connect($dsn, $username, $password) or die(&#8220;Could not connect!&#8221;);</p>
<p>$sql = &#8220;SELECT * FROM mytable&#8221;;</p>
<p>$sth = $dbh->prepare($sql);<br />
$sth->execute;</p>
<p>while(($column1, $column2) = $sth->fetchrow_array)<br />
{<br />
print &#8220;C1 = $column1, C2 = $column2n&#8221;;<br />
}</p>
<p>$dbh->disconnect;</p>
<p>where DBNAME, DBUSERNAME, and DBPASSWORD are your database name, database username and database password, and where DBSERVER is your database server.</p>
<p>Regards,<br />
Rajesh Kumar<br />
Twitt me @ <a href="http://twitter.com/RajeshKumarIn">twitter.com/RajeshKumarIn</a></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/connect-to-my-mysql-database-using-perl/">Connect to my MySQL database using Perl?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/connect-to-my-mysql-database-using-perl/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Why we use &#8216;use strict&#8217; in perl</title>
		<link>https://www.scmgalaxy.com/tutorials/why-we-use-use-strict-in-perl/</link>
					<comments>https://www.scmgalaxy.com/tutorials/why-we-use-use-strict-in-perl/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 11:33:41 +0000</pubDate>
				<category><![CDATA[Perl Script]]></category>
		<category><![CDATA[Perl]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2484</guid>

					<description><![CDATA[<p>scmuser created the topic: Why we use &#8216;use strict&#8217; in perl Hi, Why you should &#8216;use strict&#8217;? what is the [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/why-we-use-use-strict-in-perl/">Why we use &#8216;use strict&#8217; in perl</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>scmuser created the topic: Why we use &#8216;use strict&#8217; in perl</strong></p>
<p>Hi,</p>
<p>Why you should &#8216;use strict&#8217;? what is the significant of &#8220;strict&#8221; in out module?</p>
<p><strong>rajeshkumar replied the topic: Re: Why we use &#8216;use strict&#8217; in perl</strong></p>
<p>Whenever your program gets over a few lines long, definitely when you can&#8217;t view the whole program on one page, or sometimes when you just can&#8217;t figure out what else could be wrong.</p>
<p>To help you catch typos so you can quickly get on to finding more significant problems (and so we don&#8217;t have to catch the typos for you either), among other reasons.<br />
Its difficult to spot &#8216;$recieve_date&#8217; when on the previous page you&#8217;ve been calling it &#8216;$receive_date&#8217;. Also, to give your variables as small a scope as possible so that you don&#8217;t have to worry about what they&#8217;re doing to other parts of your program (although that&#8217;s the function of my, it forces you to use my which when properly used helps achieve this goal).</p>
<p>Put this line at the top of your script (after the shebang, e.g., &#8216;#!/usr/bin/perl&#8217; line):</p>
<p><code>use strict;<br />
# Change this:<br />
$string = "hello world";<br />
@array = qw(ABC DEF);<br />
%hash = (A=>1, B=>2);</p>
<p># To this:<br />
my $string = "hello world";<br />
my @array = qw(ABC DEF);<br />
my %hash = (A=>1, B=>2);</p>
<p># Change this:<br />
# '$name' is global here<br />
foreach $name (@names) {<br />
 print "Name: $name\n";<br />
}</p>
<p># To this:<br />
foreach my $name (@names) {<br />
 # Now '$name' only exists in this block<br />
 print "Name: $name\n";<br />
}</p>
<p># Change this:<br />
# Likewise, '$digit' is global here<br />
foreach $digit (@digits) {<br />
 $number = 10*$number + $digit;<br />
}<br />
print "Number: $number\n";</p>
<p># To this (variables used in an outer scope ('$number')<br />
# will have to be declared in an outer scope):<br />
my $number = 0;<br />
foreach my $digit (@digits)<br />
 # Now '$digit' only exists in this block<br />
 $number = 10*$number + $digit;<br />
}<br />
print "Number: $number\n";</p>
<p># Change this:<br />
sub my_sub {<br />
 ($arg1, $arg2) = @_;<br />
 print "Arg1: $arg1 Arg2: $arg2\n";<br />
}</p>
<p># To this:<br />
sub my_sub {<br />
 my ($arg1, $arg2) = @_;<br />
 print "Arg1: $arg1 Arg2: $arg2\n";<br />
}</p>
<p># Using DBI? You can change this:<br />
$sth->bind_columns(\$field1, \$field2);<br />
while ($sth->fetch) {<br />
 print "F1: $field1 F2: $field2\n";<br />
}</p>
<p># To this (the '\' is distributed over a list of values):<br />
$sth->bind_columns(\my ($field1, $field2));<br />
while ($sth->fetch) {<br />
 print "F1: $field1 F2: $field2\n";<br />
}</code></p>
<p>Regards,<br />
Rajesh Kumar<br />
Twitt me @ <a href="http://twitter.com/RajeshKumarIn">twitter.com/RajeshKumarIn</a></p>
<p><strong>rajeshkumar replied the topic: Re: Why we use &#8216;use strict&#8217; in perl</strong></p>
<p>Some More Helpful info&#8230;</p>
<p>By default Perl allows you to use variables without declaring them. This may be convenient for short scripts and one-liners.But in a longer unit of code such as a module it is wise to declare your variables both to catch typos and to constrain their accessibility appropriately from outside the module. The strict pragmaforces you to declare your variables.</p>
<p>If no import list is supplied, all possible restrictions are assumed. (This is the safest mode to operate in, but is sometimes too strict for casual programming.) Currently, there are three possible things to be strict about: &#8220;subs&#8221;, &#8220;vars&#8221;, and &#8220;refs&#8221;.</p>
<p>strict refs<br />
This generates a runtime error if you use symbolic references<br />
1. use strict &#8216;refs&#8217;;<br />
2. $ref = \$foo;<br />
3. print $$ref; # ok<br />
4. $ref = &#8220;foo&#8221;;<br />
5. print $$ref; # runtime error; normally ok<br />
6. $file = &#8220;STDOUT&#8221;;<br />
7. print $file &#8220;Hi!&#8221;; # error; note: no comma after $file</p>
<p>strict vars </p>
<p>This generates a compile-time error if you access a variable that wasn&#8217;t declared via our or use vars , localized via my(), or wasn&#8217;t fully qualified. Because this is to avoid variable suicide problems and subtle dynamic scoping issues, a merely local() variable isn&#8217;t good enough.<br />
1. use strict &#8216;vars&#8217;;<br />
2. $X::foo = 1; # ok, fully qualified<br />
3. my $foo = 10; # ok, my() var<br />
4. local $foo = 9; # blows up<br />
5.<br />
6. package Cinna;<br />
7. our $bar; # Declares $bar in current package<br />
8. $bar = &#8216;HgS&#8217;; # ok, global declared via pragma</p>
<p>strict subs<br />
This disables the poetry optimization, generating a compile-time error if you try to use a bareword identifier that&#8217;s not a subroutine, unless it is a simple identifier (no colons) and that it appears in curly braces or on the left hand side of the => symbol<br />
1. use strict &#8216;subs&#8217;;<br />
2. $SIG{PIPE} = Plumber; # blows up<br />
3. $SIG{PIPE} = &#8220;Plumber&#8221;; # just fine: quoted string is always ok<br />
4. $SIG{PIPE} = \&Plumber; # preferred form</p>
<p>Regards,<br />
Rajesh Kumar<br />
Twitt me @ <a href="http://twitter.com/RajeshKumarIn">twitter.com/RajeshKumarIn</a></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/why-we-use-use-strict-in-perl/">Why we use &#8216;use strict&#8217; in perl</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/why-we-use-use-strict-in-perl/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Why do you program in Perl?</title>
		<link>https://www.scmgalaxy.com/tutorials/why-do-you-program-in-perl/</link>
					<comments>https://www.scmgalaxy.com/tutorials/why-do-you-program-in-perl/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 11:31:04 +0000</pubDate>
				<category><![CDATA[Perl Script]]></category>
		<category><![CDATA[Perl]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2482</guid>

					<description><![CDATA[<p>scmuser created the topic: Why do you program in Perl? Why do you program in Perl? What are the advantages [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/why-do-you-program-in-perl/">Why do you program in Perl?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>scmuser created the topic: Why do you program in Perl?</strong></p>
<p>Why do you program in Perl? What are the advantages of Perl ovber python and other languages?</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/why-do-you-program-in-perl/">Why do you program in Perl?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/why-do-you-program-in-perl/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Difference between exec and system in perl?</title>
		<link>https://www.scmgalaxy.com/tutorials/difference-between-exec-and-system-in-perl/</link>
					<comments>https://www.scmgalaxy.com/tutorials/difference-between-exec-and-system-in-perl/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 11:29:36 +0000</pubDate>
				<category><![CDATA[Perl Script]]></category>
		<category><![CDATA[Perl]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2480</guid>

					<description><![CDATA[<p>scmuser created the topic: Difference between exec and system in perl? What are the Difference between exec and system in [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/difference-between-exec-and-system-in-perl/">Difference between exec and system in perl?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>scmuser created the topic: Difference between exec and system in perl?</strong></p>
<p>What are the Difference between exec and system in perl? please explain&#8230;.</p>
<p><strong>rajeshkumar replied the topic: Re: Difference between exec and system in perl?</strong></p>
<p>exec function in perl</p>
<p>The exec function executes a system command and never returns; use system instead of exec if you want it to return. It fails and returns false only if the command does not exist and it is executed directly instead of via your system&#8217;s command shell</p>
<p>Since it&#8217;s a common mistake to use exec instead of system, Perl warns you if there is a following statement that isn&#8217;t die, warn, or exit (if -w is set&#8211;but you always do that, right?). If you really want to follow an exec with some other statement, you can use one of these styles to avoid the warning:<br />
exec (&#8216;foo&#8217;) or print STDERR &#8220;couldn&#8217;t exec foo: $!&#8221;;<br />
{ exec (&#8216;foo&#8217;) }; print STDERR &#8220;couldn&#8217;t exec foo: $!&#8221;;</p>
<p>Example:<br />
$shell = &#8216;/bin/csh&#8217;;<br />
exec $shell &#8216;-sh&#8217;; # pretend it&#8217;s a login shell</p>
<p>or<br />
exec {&#8216;/bin/csh&#8217;} &#8216;-sh&#8217;; # pretend it&#8217;s a login shell</p>
<p>More..</p>
<p>Executes a system command (directly, not within a shell) and never returns to the calling script, except if the command specified does not exist and has been called directly, instead of indirectly through a shell. The operation works as follows:</p>
<p>* If there is only one scalar argument that contains no shell metacharacters, then the argument is converted into a list and the command is executed directly, without a shell.<br />
* If there is only one scalar argument that contains shell metacharacters, then the argument is executed through the standard shell, usually /bin/sh on Unix.<br />
* If LIST is more than one argument, or an array with more than one value, then the command is executed directly without the use of a shell.</p>
<p>Return Value: 0 only if the command specified cannot be executed</p>
<p>Example</p>
<p>Following are the usage&#8230;<br />
exec &#8216;/bin/echo&#8217;, &#8216;Your arguments are: &#8216;, @ARGV;<br />
    exec &#8220;sort $outfile | uniq&#8221;;</p>
<p>Another example:<br />
exec {&#8216;/bin/csh&#8217;} &#8216;-sh&#8217;;	# pretend it&#8217;s a login shell</p>
<p>System function in perl</p>
<p>Does exactly the same thing as exec LIST , except that a fork is done first, and the parent process waits for the child process to exit. Note that argument processing varies depending on the number of arguments. If there is more than one argument in LIST, or if LIST is an array with more than one value, starts the program given by the first element of the list with arguments given by the rest of the list.</p>
<p>Executes the command specified by PROGRAM, passing LIST as arguments to the command.The return value is the exit status of the program as returned by the wait function. To obtain the actual exit value, divide by 256.</p>
<p>Return Value : Exit status of program as returned by wait</p>
<p>Example</p>
<p>Try out following example:<br />
#!/usr/bin/perl -w<br />
system(&#8220;ls -F /var > /tmp/t.tmp&#8221;);</p>
<p>It will produce following result:</p>
<p>A file in /tmp direcory, check it out.</p>
<p>Regards,<br />
Rajesh Kumar<br />
Twitt me @<a href="http://twitter.com/RajeshKumarIn"> twitter.com/RajeshKumarIn</a></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/difference-between-exec-and-system-in-perl/">Difference between exec and system in perl?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/difference-between-exec-and-system-in-perl/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Embed perl in a C++ program / Java Program?</title>
		<link>https://www.scmgalaxy.com/tutorials/embed-perl-in-a-c-program-java-program/</link>
					<comments>https://www.scmgalaxy.com/tutorials/embed-perl-in-a-c-program-java-program/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 11:27:22 +0000</pubDate>
				<category><![CDATA[Perl Script]]></category>
		<category><![CDATA[Perl]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2478</guid>

					<description><![CDATA[<p>scmuser created the topic: embed perl in a C++ program / Java Program? How can I embed perl in a [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/embed-perl-in-a-c-program-java-program/">Embed perl in a C++ program / Java Program?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>scmuser created the topic: embed perl in a C++ program / Java Program?</strong><br />
How can I embed perl in a C++ program / Java Program?</p>
<p>Any sample program??</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/embed-perl-in-a-c-program-java-program/">Embed perl in a C++ program / Java Program?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/embed-perl-in-a-c-program-java-program/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
