open my $fd, '<', 'foo' or die open "$!\n"; my ($h, @arr); ## assuming and are always at the end of their lines while (<$fd>) { $h .= $_; ## We store header in $h. I won't parse it. last if /$/; } my $c = 0; while (<$fd>) { next if /^\n$/; my @fields = split / /, $_; foreach (@fields) { my ($k, $v) = $_ =~ /^(<[^>]+>)(.*)$/; next if $k eq ''; $arr[$c]{$k} = $v; } $c++ if /$/; } close $fd;