if ($file =~ $spec_text){ my $file_date = (split(/\./,$file))[3]; open(IN, '<', $file) or die("open failed: $!"); my @rows; while () { chomp; my @eles = split(";",$_); push @rows,$eles[0].";".$eles[1].";".$file_date; } print scalar(@rows),"\n"; my @non_dupe_rows = do { my %seen;grep !$seen{$_}++, @rows }; print scalar(@non_dupe_rows),"\n"; }