#! /tools/perl/5.8.8/linux/bin/perl use strict; use warnings; use Data::Dumper; # Source script my $report = $ARGV[1] ; my $waiver = $ARGV[3] ; my $result = $ARGV[5] ; # Set up a hash to receive the information my %identifier = (); # Read the violations file into the hash open my $filter, '<', $waiver or die; while (my $vline = <$filter>) { next unless $vline =~ /\S/; #skip blank lines my ($pins2, $w2, $h2) = split /,/, $vline; $identifier{$pins2}{'w2'} = $w2; $identifier{$pins2}{'h2'} = $h2; } print Dumper \%identifier; # Read input file line by line and compare 2 files open my $input, '<', $report or die; open my $output, ">", $result or die; while (my $wline = <$input>){ my ($pins1, $nets, $w1, $h1, $slack) = split /\s+/, $wline; # delete the contents if matched if (exists $identifier{$pins1}) { if ( ($w1 == $identifier{$pins1}{'w2'}) && ($h1 <= $identifier{$pins1}{'h2'}) ) { my $start = 1; } else { my $start = 0; } } else { my $start = 0; } printf $output "$wline"; next if (my $start == 0); #if ($start == 0) { # printf $output "%-44s %-24s %-8s %-8s %-8s %-10s\n", $pins1, $nets1, $w1, $h1, $slack; # } } close $filter; close $input; close $output;