for (%fileAArrayOfHashes) for (%fileBArrayOfHashes) if (file A column A matches file b column A) { add the columns you want to %hashC push (@fileCarrayOfHashes,\%hashC)