in reply to Extraction of set of lines using regular expression

[ This is my new answer to the new (i.e. updated) question. ]

Style issues aside, there's nothing wrong with your code. It works for me with no changes. For example,

while (<DATA>) { if ($_ =~ /^E/gi || $_ =~ /gmake.*/gi) { push (@errors, $_) } } print(@errors); __DATA__ E : abcdfcsds 1387382 43243 ijigje jg445 3u4 (53545545) E : abcdfcsds 1387382 43243 ... E : abcdfcsds 1387382 43243 ijigje jg445 3u4 (53545545) gmake : **** build failed fdjgu43uffer Error 1
outputs
E : abcdfcsds 1387382 43243 E : abcdfcsds 1387382 43243 E : abcdfcsds 1387382 43243 gmake : **** build failed fdjgu43uffer Error 1

Are you saying you are getting something different?

I said "style issues aside" earlier, because your code stands to be improved. $_ =~ is unnecessary, /i is unnecessary here, /g is even more useless, and your regexps would be more robust if they were more restrictive, as follows:

while (<DATA>) { if (/^(?:E|gmake)\s*:/) { push(@errors, $_); } }