can I suggest other implementation?

Code: Perl
sub in_array {
     my ($arr,$search_for) = @_;
     return grep {$search_for eq $_} @$arr;
}

or

Code: Perl
sub in_array {
      my ($arr,$search_for) = @_;
     foreach my $value @$arr {
         return 1 if $value eq $search_for;
     }
     return 0;
 }