sub buildFmt { my $templ = shift; my @cols; push @cols, $-[ 0 ] while $templ =~ m[(?<=\s\s)(?=\S)]gc; my $p = 0; my $fmt = ''; $fmt .= 'A' . ( $_ - $p ) . ' ' and $p = $_ for @cols; return $fmt; }