in reply to reading matrix and printing

My first stab, thought up real fast, most likely not the best solution:

use strict; use warnings; my (@one, @two, @three); while (<DATA>) { chomp; /([^ ]+) ([^ ]+) ([^ ]+)/; push @one, $1; push @two, $2; push @three, $3; } print join("\n", join(' ', @one), join(' ', @two), join(' ', @three)), + "\n"; __DATA__ 1 cow MM 2 cat DD 3 fly SS