It looks to me like each "line" ends with either KEY or CERT, and none of the filenames include space characters. Assuming that is true, and that you have/can get the "Garbled Output" into a single string,
split could work:
@filenames = split /\s.*?(?:KEY|CERT)/, $garbled_output;
The regex is:
/s whitespace
.*? any character (.), unlimited length (*), as few as possible (?
+)
(?: non-capturing group
KEY literal
| OR
CERT literal
) end group