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 reply to Re: Parsing multiple rows of text and converting to columns
by Laurent_R
in thread Parsing multiple rows of text and converting to columns
by gingeremmie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |