my $str = 'barp'; $str = ">".$str until (length$str >=10); ## in case it is already more than 10... print $str . "\n";