#!/usr/bin/perl use strict; use warnings; die "Usage: $0 \n" unless @ARGV == 2; my ($file2, %have)=pop; while (<>) { chomp; $have{ (split /,/)[0] }=1; } @ARGV=$file2; my %saw; $\="\n"; while (<>) { chomp; local $_=(split /,/)[1]; next if $saw{$_}++; print if $have{$_}; } __END__