in reply to Extraction of set of lines using regular expression
Or if you want it to match only when gmake is at the start as well, and just made a typing error:while (<DATA>) { push @errors, $_ if m/^E|gmake/i; } print @errors; __DATA__ E : abcdfcsds 1387382 43243 ijigje jg445 3u4 (53545545) E : abcdfcsds 1387382 43243 ijigje jg445 3u4 (53545545) E : abcdfcsds 1387382 43243 ijigje jg445 3u4 (53545545) E : abcdfcsds 1387382 43243 ijigje jg445 3u4 (53545545) E : abcdfcsds 1387382 43243 ijigje jg445 3u4 (53545545) gmake : **** build failed fdjgu43uffer Error 1
push @errors, $_ if m/^(?:E|gmake)/i;
|
|---|