I\'m trying to figure out the proper PBP approved way to process a multi line string one line at a time. Many Perl coders suggest treating the multi line string as a filehandle
Convert the multi-line string into a list of single line strings with split
:
my @resultLines = split /\n/, $result; # or /\r\n/ for Windows?
foreach my $resultLine (@resultLines) {
if ($resultLine =~ m/joe/) {
$matchLines
= $matchLines . "\t"
. $resultLine . "\n"; # put \n or \r\n back on the end
}
}