in reply to How to parse a scalar variable

Parsing lines in a file is essentially treating the file as an array of lines. To treat a scalar as an array of lines, split it on newlines. Something like this:
for my $line(split /\n/,$header){ # process $line as though it came from a <> }