use strict; use warnings; use Text::Autoformat; my $str=qw/@/; for my $i(1..11){ my $newStr = autoformat ($str, { justify => 'center' }); print "$newStr\n"; $str .= '@@' if $i <= 5; substr $str, -2, 2, '' if $i > 5; }