if ($_ =~ $identifier{$pins1.}) {
This doesn't work. {$pins1.} is a syntax error. There is no wildcard lookup in a hash.
$vline =~ s/^\S+//; #trim leading space
Nope. \S is non-blank.
my (undef,$scenario, $pins1, $threshold1, $newthreshold1, $diff, $stat
+us) = split /\s+/, $wline;
Your key is ending up in $scenario here. Skip the undef.
If you encounter an identifier with a wildcard in the waiver file, you need to rewrite that identifier as a valid perl regular expression and later match each key of the waiver hash against the current $pins1:
#! /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
print $vline;
$vline =~ s/^\s+//; #trim leading space
my ($pins2, $threshold2, $newthreshold2) = split /,/, $vline;
$pins2 =~ s/\*$/.*/; # make key into regex string if trailing *
$identifier{$pins2}{'threshold2'} = $threshold2;
$identifier{$pins2}{'newthreshold2'} = $newthreshold2;
}
close $filter;
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 ($scenario, $pins1, $threshold1, $newthreshold1, $diff, $status
+) = split /\s+/, $wline;
# overwrite values if match
for my $key(keys %identifier) {
if ($pins1 =~ /^$key$/) {
if ( ($threshold1 == $identifier{$key}{'threshold2'}) && (
+$newthreshold1 <= $identifier{$key}{'newthreshold2'}) ) {
$status = '(WAIVED)';
}
last; # skip remaining keys of for()-loop
}
}
printf $output "%-44s %-24s %-8s %-8s %-8s %-10
+s\n", $scenario, $pins1, $threshold1, $newthreshold1,
+ $diff, $status;
}
close $input;
close $output;
Close your filehandles as soon as you are done with them.
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'