in reply to Grepping the filehandler
There will always be a loop whether expressed or implied. Here's an SSCCE:
#!/usr/bin/env perl use strict; use warnings; print /(error.*)/ ? $1 : '' for <DATA>; __DATA__ foo error bar baz
And the output is one line with error bar.
🦛
|
|---|