in reply to Search element of array in another array

I think the problem might be, the whole list is probably "slurped" into one element of the array only.
Yes. According to File::Slurp::Tiny, read_file:
Reads file $filename into a scalar. By default it returns this scalar.

One way is to split:

my @allwords = split /\n/, read_file($ref);