Because I can\'t find a convenient way to check if $str is in @array, I\'m trying to make one myself, but it is not working.
$str
@array
I guess it is
You may want to check any in the List::MoreUtils package, you just use it like:
use List::MoreUtils 'any'; my @f= qw(1 2 3 4); my $k=10; print "yes\n" if( any { $_ == $k } @f );
check the documentation in:
perldoc List::MoreUtils.