you will not be able to compare hashes but you can convert your data to strings and it will make it easier , something like this<br><br>#!perl<br>use strict;<br><br>use warnings;<br>use Data::Dumper;<br><br>my @arr =(<br>{<br>
    &#39;row&#39; =&gt; 33,<br>    &#39;col&#39; =&gt; 1,<br>    &#39;value&#39; =&gt; &#39;xx&#39;,<br>},<br><br>{<br>    &#39;row&#39; =&gt; 30,<br>    &#39;col&#39; =&gt; 1,<br>    &#39;value&#39; =&gt; &#39;zz&#39;,<br>
},<br><br>{<br>    &#39;row&#39; =&gt; 34,<br>    &#39;col&#39; =&gt; 1,<br>    &#39;value&#39; =&gt; &#39;yy&#39;,<br>},<br><br>);<br><br>my @arr1 =(<br><br>{<br>    &#39;row&#39; =&gt; 33,<br>    &#39;col&#39; =&gt; 1,<br>
    &#39;value&#39; =&gt; &#39;xx&#39;,<br>},<br><br>{<br>    &#39;row&#39; =&gt; 30,<br>    &#39;col&#39; =&gt; 1,<br>    &#39;value&#39; =&gt; &#39;zz&#39;,<br>},<br><br>{<br>    &#39;row&#39; =&gt; 35,<br>    &#39;col&#39; =&gt; 1,<br>
    &#39;value&#39; =&gt; &#39;yy&#39;,<br>},<br><br>);<br><br><br>my @vals =  map {$_-&gt;{&#39;row&#39;} &gt; 32 &amp;&amp; $_-&gt;{&#39;col&#39;} &gt; 0 ?stringify(%$_):()} @arr;<br>my @vals1 =  map {$_-&gt;{&#39;row&#39;} &gt; 32 &amp;&amp; $_-&gt;{&#39;col&#39;} &gt; 0 ?stringify(%$_):()} @arr1;<br>
<br><br>my %hash;<br>@hash{@vals} = 1  x @vals;<br>my @diff =  grep {not exists$hash{$_}} @vals1;<br><br><br>sub stringify {<br>     return &quot;@_&quot;;<br>}<br><br><br><br><br><div class="gmail_quote">2009/6/15 Srinivas Reddy <span dir="ltr">&lt;<a href="mailto:SReddy@securities.com">SReddy@securities.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">










<div link="blue" vlink="blue" lang="EN-US">

<div>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Hi Thnx a lot for your quick help. Sry C
is rules out as this willl form a part of perl script and we have ‘C’
Expertise issue as well. I think kumars solution would really help . Let us
rewrite it and check the performance. </span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">I am still looking at a function which
takes 2 arrays and gives me the difference in them , in my case these array
contain my xls file ( row , col and value associated with each cell ) . </span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Regards,</span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>

<div>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Srinivas Reddy</span></font><font color="navy"><span style="color: navy;"></span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Asia</span></font><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> Technology and Global Projects Manager </span></font><font color="navy"><span style="color: navy;"></span></font></p>


<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Skype : sreddyisi</span></font><font color="navy"><span style="color: navy;"></span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Cell : +91 9740076449</span></font><font color="navy"><span style="color: navy;"></span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">LandLine : +91 9900524073/74/76./78</span></font><font color="navy"><span style="color: navy;"></span></font></p>


<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;">Fax : +91 8026729764</span></font><font color="navy"><span style="color: navy;"></span></font></p>

<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="PL">Url : </span></font><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"><a href="http://www.securities.com/" target="_blank"><font color="purple"><span style="color: purple;" lang="PL">www.securities.com</span></font></a></span></font><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;"> <span lang="PL"></span></span></font></p>


<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="PL"><a href="http://www.thefinancialnet.com" target="_blank"><font color="purple"><span style="color: purple;">www.thefinancialnet.com</span></font></a></span></font><font color="navy"><span style="color: navy;"></span></font></p>


<p><font size="2" color="navy" face="Arial"><span style="font-size: 10pt; font-family: Arial; color: navy;" lang="PL"><a href="http://elearning.securities.com" target="_blank">elearning.securities.com</a></span></font><font color="navy"><span style="color: navy;"></span></font></p>


<p><font size="5" color="#008400" face="Webdings"><span style="font-size: 18pt; font-family: Webdings; color: rgb(0, 132, 0);">P</span></font><font color="blue"><span style="color: blue;"> </span></font><span><font size="1" color="#008400" face="Verdana"><span style="font-size: 7.5pt; font-family: Verdana; color: rgb(0, 132, 0);">Please</span></font></span><font size="1" color="#008400" face="Verdana"><span style="font-size: 7.5pt; font-family: Verdana; color: rgb(0, 132, 0);">
consider the environment before printing this email</span></font></p>

</div>

<div>

<div style="text-align: center;" align="center"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">

<hr size="2" width="100%" align="center">

</span></font></div>

<p><b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font size="2" face="Tahoma"><span style="font-size: 10pt; font-family: Tahoma;"> <a href="mailto:simrangambhir@gmail.com" target="_blank">simrangambhir@gmail.com</a>
[mailto:<a href="mailto:simrangambhir@gmail.com" target="_blank">simrangambhir@gmail.com</a>] <b><span style="font-weight: bold;">On Behalf Of
</span></b>simran<br>
<b><span style="font-weight: bold;">Sent:</span></b> Monday, June 15, 2009 6:17
PM<br>
<b><span style="font-weight: bold;">To:</span></b> Srinivas Reddy<br>
<b><span style="font-weight: bold;">Cc:</span></b> <a href="mailto:bangalore-pm@pm.org" target="_blank">bangalore-pm@pm.org</a><br>
<b><span style="font-weight: bold;">Subject:</span></b> Re: [Bangalore-pm] Need
Help to optimise the code</span></font></p>

</div><div><div></div><div class="h5">

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;"> </span></font></p>

<p style="margin-bottom: 12pt;"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">Hi Srinivas, <br>
<br>
The code is not very complex, and unless you change the structure, it will not
optimise too much... better to write it neatly (and with better arg passing...
as suggested in the email by Ravish. <br>
<br>
If you are looking for absolute speed, better to write in in C and plug it in
via XS. <br>
<br>
simran.</span></font></p>

<div>

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;">2009/6/15 Srinivas Reddy &lt;<a href="mailto:SReddy@securities.com" target="_blank">SReddy@securities.com</a>&gt;</span></font></p>

<div link="blue" vlink="purple">

<div>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Hi
, </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Please
help to optimize the code below.  We basically read 2 xls files into an
array @xls2 and @xls1 . For each cell we want to compare ( starting from col 32
) values in each cell and if they are not equal we need to store it in a
different array. This we will then use to bold those particular cells. </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">The
loop which does this comparison could be replacement by some in built array
difference kind of function. I am new to perl so apologies if I ve used any
wrong terminologies here.  Appreciate your help on the same. Please find
attached whole code as well for reference </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">sub
cell_handler2 {</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">       
my $workbook    = $_[0];</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">       
my $sheet_index = $_[1];</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">       
my $row         = $_[2];</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">       
my $col         = $_[3];</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">       
my $cell        = $_[4];</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">           
 # Construct array for Dx code</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">           
 </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">       
push @xls2 , {</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">                       
&#39;row2&#39; =&gt; $row,</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">                       
&#39;col2&#39; =&gt; $col,</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">                       
&#39;value2&#39; =&gt; $cell-&gt;value(),</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">       
};</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">       
return @xls2;</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">}</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">#print
Dumper(@xls2);</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">#
Print the End Time to read second excel file</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">print
scalar(localtime) . &quot;: End Reading Excel2 \n&quot;;</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">print
scalar(localtime) . &quot;: Start Populating Bolding Array \n&quot;;</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">#
Inefficient way of looping</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">#
Please change this as it could boost the performance significantly </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">for(@xls2)
{</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">           
if($_-&gt;{&#39;col2&#39;} &gt; 32 &amp;&amp; $_-&gt;{&#39;row2&#39;} &gt; &#39;0&#39; ) {</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">                                   
$newvalue = $_-&gt;{&#39;value2&#39;};</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">                                   
$newrow = $_-&gt;{&#39;row2&#39;};</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">                                   
$newcol = $_-&gt;{&#39;col2&#39;};</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">                                   
for(@xls1) {</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">                                               
$oldrow = $_-&gt;{&#39;row1&#39;};</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">                                               
$oldcol = $_-&gt;{&#39;col1&#39;};    </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">                                               
if($_-&gt;{&#39;col1&#39;} &gt; 32 &amp;&amp; $_-&gt;{&#39;row1&#39;} &gt; 0 &amp;&amp;
$_-&gt;{&#39;row1&#39;} eq $newrow &amp;&amp; $_-&gt;{&#39;col1&#39;} eq $newcol) {</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">                                                                       
$oldvalue = $_-&gt;{&#39;value1&#39;};</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">                                                                       
last;</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">                                               
}</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">                                   
}</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">                                   
if($oldvalue ne $newvalue) {</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">                                               
push @bold_array , {</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">                                                           
&#39;row&#39; =&gt; $_-&gt;{&#39;row2&#39;},</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">                                                           
&#39;col&#39; =&gt; $_-&gt;{&#39;col2&#39;},</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">                                                           
&#39;value&#39; =&gt; $_-&gt;{&#39;value2&#39;},</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">                                               
};</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">                                   
}</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">           
}</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">}</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Regards,</span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font size="2" face="Arial"><span style="font-size: 10pt; font-family: Arial;">Srinivas
Reddy</span></font></p>

</div>

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><br>
______________________________________________________________________<br>
This communication contains information which is confidential. It is for the<br>
exclusive use of the intended recipient(s). If you are not the intended<br>
recipient(s) please note any distribution, copying or use of this<br>
communication or the information in it is strictly prohibited. If you have<br>
received this communication in error please notify us by e-mail or<br>
by telephone (as above) and then delete the e-mail and all attachments and<br>
any copies thereof.<br>
______________________________________________________________________</span></font></p>

</div>

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><br>
_______________________________________________<br>
Bangalore-pm mailing list<br>
<a href="mailto:Bangalore-pm@pm.org" target="_blank">Bangalore-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/bangalore-pm" target="_blank">http://mail.pm.org/mailman/listinfo/bangalore-pm</a></span></font></p>

</div>

<p><font size="3" face="Times New Roman"><span style="font-size: 12pt;"> </span></font></p>

</div></div></div><div><div></div><div class="h5">


<br>
______________________________________________________________________<br>
This communication contains information which is confidential. It is for the<br>
exclusive use of the intended recipient(s). If you are not the intended<br>
recipient(s) please note any distribution, copying or use of this<br>
communication or the information in it is strictly prohibited. If you have<br>
received this communication in error please notify us by e-mail or<br>
by telephone (as above) and then delete the e-mail and all attachments and<br>
any copies thereof.<br>
______________________________________________________________________<br>
</div></div></div>


<br>_______________________________________________<br>
Bangalore-pm mailing list<br>
<a href="mailto:Bangalore-pm@pm.org">Bangalore-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/bangalore-pm" target="_blank">http://mail.pm.org/mailman/listinfo/bangalore-pm</a><br></blockquote></div><br>