perl -walne '$h{$ARGV}{$F[0]}.="$F[1]";END{ print ...}' file1.txt file2.txt