while () { my @tokens = split ' ', $_; my $format = '%-10s ' x @tokens; printf "$format\n", @tokens; }