http://qs321.pair.com?node_id=1060047


in reply to Matching 2 unordered arrays then printing the first array highlighting the matches?

You create a hash with all elements of array2 as the keys. When iterating through array1, you check whether the elements exists in the hash.

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