in reply to Right justifying text in a template field

pack is meant for creating C structs, not for formatting. Try printf/sprintf:

$formatted = sprintf('%5s', 'abc'); # ' abc' $formatted = sprintf('%-5s', 'abc'); # 'abc '

You could always pack what sprintf returns, if you need pack.