perlquestion
sumathigokul
<p> Hi all, </p>
<p>i have a text file that contains the following lines </p>
<code>
High fanout nets in the post compile netlist:
Fanout Type Name
--------------------------
2 INT_NET Net : c_c
Driver: c_pad
2 INT_NET Net : b_c
Driver: b_pad
2 INT_NET Net : a_c
Driver: a_pad
1 INT_NET Net : sum_c
Driver: sum_1_SUM0_0
1 INT_NET Net : N_5
Driver: sum_1_CO0_i
</code>
<p>I have to write a perl script that saves the following statements only, i.e. high fanout nets alone. For that, if i write a script which find maximum number in my text file and copies those statements in new file, it will copy the following statements. </p>
<code>
2 INT_NET Net : c_c
2 INT_NET Net : b_c
2 INT_NET Net : a_c
</code>
<p> Here is the code i tried, but could not get the text file as i wish.... </p>
<code>
my $high_number = 0;
open (F1, "<new.txt") or die "cant open it$!";
while (<F1>) {
my ($number) = m/:(\d+):/;
$high_number = $number if $number > $high_number;
}
print "Highest number found = $high_number\n";
close (F1);
</code>
<p> please help me out in this, thank you all....</p>