my @list1; my @list2; my %t; @t{@list2} = (); for ( @list1 ) { print "$_ found" if exists $t{$_}; }