in reply to Parsing multiple rows of text and converting to columns
You could use a regex to fetch the last part of the line and read immediately the next line. Something like this:
my %vals; while (my $line = <$IN>) { if ($line =~ />/) { my $element = $1 if $line =~ /\|([^|]+)>\s*$/; $line = <$IN>; chomp $line; $vals{$element}=$line; } }
Then you only need to print the hash.
|
---|
In Section
Seekers of Perl Wisdom