foreach my $x (0..$#{$arr1}) { if($arr1->[$x] eq $1){$found++} }