Help for this page

Select Code to Download


  1. or download this
    $padded = sprintf("%-10s", $string);    #or use pack "A10"
    $padded = s/( +)$/"0" x length $1/e;
    
  2. or download this
    $padded = reverse sprintf("%010s", scalar reverse $string);
    
  3. or download this
    $padded = "0" x 10;
    substr($padded, 0, length $string) = $string;