Pad or truncate a string to a fixed length, $len, . . .
Padding is spaces; for ASCII NUL bytes use the 'a' or 'Z' format instead. 'Z' guarantees at least one NUL, for dealing with C strings.
$_ = pack 'A'.$len, $_;
In reply to A Procrustean Statement by Zaxo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |