while(){ chomp; my @cols = split/\s+/,$_; for my $ix (0..$#cols){ push @{$data[$ix]}, $cols[$ix]; } }