Since your headers array contains regexp meta characters, like parens, they are interpreted instead of matched. You don't really want that, and should either use
quotemeta on each of the strings when constructing the header array (to make sure all characters that will do something special in the regexp are forced to be interpreted literally, using \ infront of them (you can also use /\Q$header/)), or change the regexp to
push (@random_record, $element) if (index($element,$header) != -1);
The
index function does exact substring matching. It will suite your requirements a bit more....
-nuffin
zz zZ Z Z #!perl