You can't have 2 hash keys as 'es' so you need a 2nd level to your %identifier hash
eg $identifier{$pins2}{$w2} = $h2

#! /tools/perl/5.8.8/linux/bin/perl use strict; use warnings; use Data::Dumper; # Source script my $report = $ARGV[1] || 'report.txt' ; my $waiver = $ARGV[3] || 'waiver.csv'; my $result = $ARGV[5] || 'result.txt'; # Set up a hash to receive the information my %identifier = (); # Read the violations file into the hash open my $filter, '<', $waiver or die "Could not open $waiver : $!"; while (my $vline = <$filter>) { next unless $vline =~ /\S/; #skip blank lines $vline =~ s/^\s+//; # trim leading spaces my ($pins2, $w2, $h2) = split /,/, $vline; $identifier{$pins2}{$w2} = $h2; } print Dumper \%identifier; # Read input file line by line and compare 2 files open my $input, '<', $report or die "Could not open $report : $!"; open my $output, '>', $result or die "Could not open $result : $!"; my $header = 1; while (my $wline = <$input>){ # skip checking the heading text if ($header == 1){ print $output $wline; $header = 0 if ($wline =~ /-------/); next; } # delete the contents if matched # undef is leading space my (undef,$pins1, $nets, $w1, $h1, $slack) = split /\s+/, $wline; if (exists $identifier{$pins1}{$w1} && $identifier{$pins1}{$w1} >= $h1) { # skip matched line print "DELETED $wline"; } else { print $output $wline; } } close $filter; close $input; close $output;
poj

In reply to Re^3: Delete lines if matched expression by poj
in thread Delete lines if matched expression by DespacitoPerl

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.