http://www.perlmonks.org?node_id=745023


in reply to Parsing multiline string line by line

You can split the string on newlines into an array, and then iterate through it in a foreach loop.

my @lines = split /\n/, $str; foreach my $line (@lines) { ... }