Hi, I am an intern and new to the world of perl. I have to enhance the script with new naming convention so it can parse the new rules. Actually this script is comparing two text files, techfile and referene file. techfile used to have old set of rules and the following script is for the old techfile. Now. I have a new techfile with few new rules, so I have to enhance the old script for the new techfile. Old tech file -

POLYNOMIAL_BASED_EM_DC { LENGTH_RANGES { 1e38 } EM_POLYNOMIALS { { 0.3802 + (13.4739 * sqrt(W/0.9)) + (4.6272 * (W/0.9)) } } } POLYNOMIAL_BASED_EM_RMS { LENGTH_RANGES { 1e38 } EM_POLYNOMIALS { { 0.3802 + (13.4739 * sqrt(W/0.9)) + (4.6272 * (W/0.9)) } } }
New tech file -
POLYNOMIAL_BASED_EM_DC { COND_RULE { L > 0 AND W > 0} EM_POLYNOMIAL { 0.3802 + (13.4739 * sqrt(W/0.9)) + (4.6272 * ( +W/0.9)) IMAX -2.632 + (27.136 * (W/0.9)) } } POLYNOMIAL_BASED_EM_RMS { COND_RULE { L > 0 AND W > 0} EM_POLYNOMIAL { 0.3802 + (13.4739 * sqrt(W/0.9)) + (4.6272 * ( +W/0.9)) } }
Here's the part of the code.

my $rw = open(FILE, $techfile); if(not defined($rw)) { die "ERROR Can't read techfile! \n"; } while(defined(my $i = <FILE>)) { chomp($i); if( $i =~ /metal/ ) { $blockMetal=1; $curlev=&LevelList("metal ",$i); $metals{$curlev}=(); } if( $i =~ /via/ ) { $blockVia=1; $curlev=&LevelList("via ",$i); $vias{$curlev}=(); } #start single metal-level extraction if($blockMetal > 0) { $zBlock=&CharCount($zBlock,$i); if( $i =~ /POLYNOMIAL_BASED_EM_DC/ ) { $blockEMDC=1; } #start extraction #POLYNOMIAL_BASED_EM_DC block for single metal level if($blockEMDC > 0) { $zzBlock=&CharCount($zzBlock,$i); push @readin, $i; #line added to array if($zzBlock == 0) { $blockEMDC=0; $readin=join(' ',@readin); #connect whole block to one + string $_=&CreateHash($readin,\%{$metals{$curlev}{'POLY_BASED +_EM_DC'}},'DC',$eps); #if(!$_) {print("$curlev DC consistent is fine!\n")};# +only for debugging if($_==1){print("$curlev DC lentgh AND width ranges bl +ock is missing!\n")} elsif($_==2){print("$curlev DC count of lentgh-ranges +AND count of EM_POLYNOMIALS blocks doesn't match!\n")} elsif($_==3){print("$curlev DC count of width-ranges A +ND count of EM_POLYNOMIALS block-lines doesn't match!\n")} + undef @readin; undef $readin; undef $zzBlock; } } #end extraction #POLYNOMIAL_BASED_EM_DC block for single metal level

In reply to To enhance the script to cover new rules by freekngeek

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.