Fine, you requested an easy method; although, faster methods
could be implementd with map or grep, assuming we
don't have detailed knowledge if elements are
already sorted in the array. Here is on easy method:
my @arr = 1..20 ;
my $num = 4;
my %h ;
@h{@arr} = (undef) x @arr;
exists $h{$num} and print qq(Yes, $num exists inside \@arr)