http://qs321.pair.com?node_id=1125789

sumathigokul has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

i have a text file that contains the following lines

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

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.

2 INT_NET Net : c_c 2 INT_NET Net : b_c 2 INT_NET Net : a_c

Here is the code i tried, but could not get the text file as i wish....

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);

please help me out in this, thank you all....