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