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