in reply to sprintf to zero-pad on the right
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
|
|---|