my @data = map {chomp; [split /:/]} ; my $width = length $data[0][0]; # Assume they're all the same length. my $Width = @{$data[0]}; my $divider = "-" x (($width + 1) * $Width); my $topline = $divider x 2; chop $topline; say $topline; foreach my $line (@data) { print "$_|" for @$line; say "\n$divider"; } __DATA__ A:B C:D #### ------- A|B| ---- C|D| ----