in reply to Clever Padding

You might try the following code for padding numbers.

my $fill = "y"; my $len = 8; my $val = 4040; my $str = substr (($fill x $len).$val, -$len, $len); print ("$str\n");

HTH, Rata

Replies are listed 'Best First'.
Re^2: Clever Padding
by BioLion (Curate) on Jan 27, 2010 at 11:43 UTC

    ...or a loop :

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

    Obviously the loop could check for anything, the length of the pad, the number of a particular character, the time...

    Updated code and added last bit

    Just a something something...