in reply to How to supply two input files at command line
$ARGV is the name of the current file being processed so you could do something like this:
perl -walne '$h{$ARGV}{$F[0]}.="$F[1]";END{ print ...}' file1.txt file +2.txt [download]