@selected_data = qw(13 76 90 13 77 100 76 300 13 65 400 74 89 34 65); @all_data = qw(1 5 2 8 12 87 13 76 98 77 89 90 11 65 43 74 43 32 34 67); my %all_hash; $all_hash{$_} = undef for @all_data; my $total = scalar grep( exists $all_hash{ $_ }, @selected_data ); print "Count (kyle) -> $total\n";