one two three four five six seven eight nine ten #### use strict; my @array = qw/one two three four five six seven eight nine ten/; my $cols = 3; my $max = 0; foreach (@array) { if (length >= $max) { $max = length $_; } } foreach (@array) { my $length = length $_; if ($length < $max) { $_ .= (' ' x ($max - $length)); } } while (@array) { unless (scalar @array >= $cols) { $cols = scalar @array; } print join(' ', splice(@array, 0, $cols) ), $/; }