my $format = '-' . ('%-10s' x @header) . "\n"; printf($format, @header); foreach my $line (@data) { printf($format, split(/-->/, $line)); }