I'm new in Perl, which is the easiest way of finding out if the item exists in an array
Like in python I can do this
item = 'apple'
list = ['apple', 'banana']
if item in list:
print item
output >>> 'apple'
In perl i can do it in this way
my $item = 'appel'
my @array = ('apple', 'banana')
for (@array){
if ($_ eq $item){ print $item }
}
The for loop will take too long if my array has more than 100 items