<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Need help to debug my perl' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Need help to debug my perl' posted on the 'Perl' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Tue, 18 Jun 2013 21:45:01 -0700</pubDate>
    <lastBuildDate>Tue, 18 Jun 2013 21:45:01 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Need help to debug my perl</title>
      <link>http://www.programmersheaven.com/mb/perl/368298/368298/need-help-to-debug-my-perl/</link>
      <description>Hi,&lt;br /&gt;
&lt;br /&gt;
I want to write a perl code to calculate total area of device pfet but the result is wrong.&lt;br /&gt;
&lt;br /&gt;
The total_area_pfet_reduce = (1.5*0.325)+ (1*0.325) =0.8125&lt;br /&gt;
&lt;br /&gt;
but my perl code give the the wrong result 1.3 because&lt;br /&gt;
&lt;br /&gt;
(1.5*0.325) + (1*0.325) + (1.5*0.325) = 1.3&lt;br /&gt;
&lt;br /&gt;
I do not why it add 3 times instead of 2 times&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
What I like to do is open the file test.cdl and find "pfet" then search for l=0.325 then add all w*l. If l is not equal 0.325 then ignore that area.&lt;br /&gt;
&lt;br /&gt;
Many thanks,&lt;br /&gt;
Tony&lt;br /&gt;
&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
##################################################
#################################&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
print " Enter device name:";&lt;br /&gt;
chomp(my $device = &amp;lt;STDIN&amp;gt;);&lt;br /&gt;
my $a = "test";&lt;br /&gt;
&lt;br /&gt;
open(IN,$a) || die "can not open $a for reading: $!";&lt;br /&gt;
&lt;br /&gt;
while (&amp;lt;IN&amp;gt;) {&lt;br /&gt;
  if ($device eq 'pfet') {&lt;br /&gt;
      if (/\bpfet/) {&lt;br /&gt;
        @str_array = split(/=/,$_);&lt;br /&gt;
         if ($str_array[2] = 0.325) {&lt;br /&gt;
           $area_reduce_pfet = $str_array[1]*$str_array[2];&lt;br /&gt;
           $total_area_pfet_reduce += $area_reduce_pfet;&lt;br /&gt;
         }&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
printf "total_area_pfet_reduce %.2f%s\n", $total_area_pfet_reduce;&lt;br /&gt;
&lt;br /&gt;
&lt;br&gt;&lt;br&gt;&lt;strong&gt;Attachment:&lt;/strong&gt; &lt;a href="http://www.programmersheaven.com/mb/DownloadAttachment.aspx?AttachmentID=121"&gt;test&lt;/a&gt; (216 bytes | downloaded 118 times)</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/perl/368298/368298/need-help-to-debug-my-perl/</guid>
      <pubDate>Thu, 27 Dec 2007 21:57:29 -0700</pubDate>
      <category>Perl</category>
    </item>
    <item>
      <title>Re: Need help to debug my perl</title>
      <link>http://www.programmersheaven.com/mb/perl/368298/368305/re-need-help-to-debug-my-perl/#368305</link>
      <description>: Hi,&lt;br /&gt;
: &lt;br /&gt;
: I want to write a perl code to calculate total area of device pfet &lt;br /&gt;
: but the result is wrong.&lt;br /&gt;
: &lt;br /&gt;
: The total_area_pfet_reduce = (1.5*0.325)+ (1*0.325) =0.8125&lt;br /&gt;
: &lt;br /&gt;
: but my perl code give the the wrong result 1.3 because&lt;br /&gt;
: &lt;br /&gt;
: (1.5*0.325) + (1*0.325) + (1.5*0.325) = 1.3&lt;br /&gt;
: &lt;br /&gt;
: I do not why it add 3 times instead of 2 times&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
: What I like to do is open the file test.cdl and find "pfet" then &lt;br /&gt;
: search for l=0.325 then add all w*l. If l is not equal 0.325 then &lt;br /&gt;
: ignore that area.&lt;br /&gt;
: &lt;br /&gt;
: Many thanks,&lt;br /&gt;
: Tony&lt;br /&gt;
: &lt;br /&gt;
: #!/usr/bin/perl&lt;br /&gt;
: ##################################################
###################&lt;br /&gt;
: ##############&lt;br /&gt;
: #&lt;br /&gt;
: &lt;br /&gt;
: print " Enter device name:";&lt;br /&gt;
: chomp(my $device = &amp;lt;STDIN&amp;gt;);&lt;br /&gt;
: my $a = "test";&lt;br /&gt;
: &lt;br /&gt;
: open(IN,$a) || die "can not open $a for reading: $!";&lt;br /&gt;
: &lt;br /&gt;
: while (&amp;lt;IN&amp;gt;) {&lt;br /&gt;
:   if ($device eq 'pfet') {&lt;br /&gt;
:       if (/\bpfet/) {&lt;br /&gt;
:         @str_array = split(/=/,$_);&lt;br /&gt;
:          if ($str_array[2] = 0.325) {&lt;br /&gt;
:            $area_reduce_pfet = $str_array[1]*$str_array[2];&lt;br /&gt;
:            $total_area_pfet_reduce += $area_reduce_pfet;&lt;br /&gt;
:          }&lt;br /&gt;
:       }&lt;br /&gt;
: &lt;br /&gt;
:         }&lt;br /&gt;
: }&lt;br /&gt;
: &lt;br /&gt;
: printf "total_area_pfet_reduce %.2f%s\n", $total_area_pfet_reduce;&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
You might want to check your condition in your third "if" clause.&lt;br /&gt;
If you are trying to test to see if $str_array[2] = 0.325, then&lt;br /&gt;
I suggest changing your condition to have am equal operator "==" &lt;br /&gt;
rather than the current assignment operator "=" your using in it.&lt;br /&gt;
&lt;br /&gt;
All the Best!&lt;br /&gt;
Old Joe &lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/perl/368298/368305/re-need-help-to-debug-my-perl/#368305</guid>
      <pubDate>Fri, 28 Dec 2007 11:41:27 -0700</pubDate>
      <category>Perl</category>
    </item>
    <item>
      <title>Re: Need help to debug my perl</title>
      <link>http://www.programmersheaven.com/mb/perl/368298/368306/re-need-help-to-debug-my-perl/#368306</link>
      <description>: : Hi,&lt;br /&gt;
: : &lt;br /&gt;
: : I want to write a perl code to calculate total area of device pfet &lt;br /&gt;
: : but the result is wrong.&lt;br /&gt;
: : &lt;br /&gt;
: : The total_area_pfet_reduce = (1.5*0.325)+ (1*0.325) =0.8125&lt;br /&gt;
: : &lt;br /&gt;
: : but my perl code give the the wrong result 1.3 because&lt;br /&gt;
: : &lt;br /&gt;
: : (1.5*0.325) + (1*0.325) + (1.5*0.325) = 1.3&lt;br /&gt;
: : &lt;br /&gt;
: : I do not why it add 3 times instead of 2 times&lt;br /&gt;
: : &lt;br /&gt;
: : &lt;br /&gt;
: : What I like to do is open the file test.cdl and find "pfet" then &lt;br /&gt;
: : search for l=0.325 then add all w*l. If l is not equal 0.325 then &lt;br /&gt;
: : ignore that area.&lt;br /&gt;
: : &lt;br /&gt;
: : Many thanks,&lt;br /&gt;
: : Tony&lt;br /&gt;
: : &lt;br /&gt;
: : #!/usr/bin/perl&lt;br /&gt;
: : ##################################################
###################&lt;br /&gt;
: : ##############&lt;br /&gt;
: : #&lt;br /&gt;
: : &lt;br /&gt;
: : print " Enter device name:";&lt;br /&gt;
: : chomp(my $device = &amp;lt;STDIN&amp;gt;);&lt;br /&gt;
: : my $a = "test";&lt;br /&gt;
: : &lt;br /&gt;
: : open(IN,$a) || die "can not open $a for reading: $!";&lt;br /&gt;
: : &lt;br /&gt;
: : while (&amp;lt;IN&amp;gt;) {&lt;br /&gt;
: :   if ($device eq 'pfet') {&lt;br /&gt;
: :       if (/\bpfet/) {&lt;br /&gt;
: :         @str_array = split(/=/,$_);&lt;br /&gt;
: :          if ($str_array[2] = 0.325) {&lt;br /&gt;
: :            $area_reduce_pfet = $str_array[1]*$str_array[2];&lt;br /&gt;
: :            $total_area_pfet_reduce += $area_reduce_pfet;&lt;br /&gt;
: :          }&lt;br /&gt;
: :       }&lt;br /&gt;
: : &lt;br /&gt;
: :         }&lt;br /&gt;
: : }&lt;br /&gt;
: : &lt;br /&gt;
: : printf "total_area_pfet_reduce %.2f%s\n", $total_area_pfet_reduce;&lt;br /&gt;
: : &lt;br /&gt;
: : &lt;br /&gt;
: &lt;br /&gt;
: You might want to check your condition in your third "if" clause.&lt;br /&gt;
: If you are trying to test to see if $str_array[2] = 0.325, then&lt;br /&gt;
: I suggest changing your condition to have am equal operator "==" &lt;br /&gt;
: rather than the current assignment operator "=" your using in it.&lt;br /&gt;
: &lt;br /&gt;
: All the Best!&lt;br /&gt;
: Old Joe &lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
Hi Old Joe,&lt;br /&gt;
&lt;br /&gt;
Thanks for helping me. It is working. &lt;br /&gt;
&lt;br /&gt;
This is the first time I post my question. This forum is very helpul.&lt;br /&gt;
&lt;br /&gt;
Many thanks,&lt;br /&gt;
Tony&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/perl/368298/368306/re-need-help-to-debug-my-perl/#368306</guid>
      <pubDate>Fri, 28 Dec 2007 11:52:34 -0700</pubDate>
      <category>Perl</category>
    </item>
  </channel>
</rss>