Here is an example using pattern matching, if your looking to see if the word is contained within any elements of the array
use v5.14;
chomp(my $word = <STDIN>); #get word from command line
#chomp removes newline for search
foreach my $name(@array){ #loop through names
if($name =~ m/$word/i){ #if the word is contained within
say $name; # print out the name with a newline (say)
}
}
otherwise, if your looking for exact maches just do something like this.
use v5.14;
chomp(my $word = <STDIN>);
foreach my $name(@array){
if($name eq $word){ #if the name equals the word
say $name;
}
}