#!/usr/bin/perl use strict; use warnings; $|=1; my $fileA =<", $FileC) || die ( "File $FileC Not Found!" ); my %B; while ( ) { chomp; my($look, $sec, $cls, $max) = split ","; $B{"$look,$sec,$cls"} = $max; } my @A; while ( ) { chomp; my($look, $sec, $cls, $att, $idx, $qtd) = split ","; my $keyA = "$look,$sec,$cls"; if (exists $B{$keyA}) { my $max = $B{$keyA}; my $tot = $qtd - 1; if ($tot >= 0) { print join(",", $look, $sec, $cls, $att, $idx, $max), "\n"; } } }