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


in reply to Converting Column Into Row

Hi,

A better way is to create a hash containing your arrays as values (I put your input into a file named 'test'):

use Data::Dumper; my %h; open FH, "test"; while (<FH>) { chomp; next if /^\s*$/; split /=/; push @{$h{$_[0]}}, $_[1]; } close FH; print Dumper \%h;
output:
$VAR1 = { 'A ' => [ ' 1', ' 2', ' 3' ], 'B ' => [ ' 5', ' 1', ' 7' ] };

Enjoy,
Mickey