my %match; undef @match{ @array2 }; for (@array1) { print "$_",exists $match{$_}?" match":"","\n"; }