@arr2 =('a', 'b'); @arr1 = ('a'); for $var1 (@arr2) { if( grep($var1, @arr1) ) { print "match $var1\n"; } } output: match a match b