in reply to remove current element out array

This type of problem is what grep was made for...
In this example, grep will return (back into @Array) every line in @Array which does not start with 'test'.
my @Array = grep {substr($_, 0, 4) ne 'test'} @Array;
You seem to be just testing for the string 'test' at the front of each line. Just modify grep's conditional as appropriate.

Russ

P.S. You normally shouldn't modify the list used in a for(each).