in reply to Match string in array

Since noone mentioned it so far,
foreach my $check (<@rray1>) {
is very dangerous and inefficient. You should use
foreach my $check (@rray1) {
instead.

<@rray1>
is equivalent to
glob(join($", @rray1))
It is dangerous because a number of characters are special to glob (including spaces).