I would normally do what matija & kvale suggest. I've also seen code that appends $field_size zeros to the print string, and then taking a substring:
$padding ="0" x $field_size; $padded_string = substring $text . $padding, 0, $field_size;
If you have a humonguous number of fields to output, it might be worth benchmarking the two methods.
--
TTTATCGGTCGTTATATAGATGTTTGCA
In reply to Re: sprintf question
by TomDLux
in thread sprintf to zero-pad on the right
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |