olecs has asked for the wisdom of the Perl Monks concerning the following question:
Now, when printing $res AAAA will be left justified and followed by 8 blanks - is it possible to make it right justified using the template mechanism? I could of course resort to using printf instead, but for my current purpose templates feel so right$TEMP = "\@0 A1 \@1 A12"; $string = "AAAA"; $res = pack($TEMP, "V", $string); print "$res\n";
pack($TEMP, "V", sprintf("%12s", "$string"));
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Right justifying text in a template field
by ikegami (Patriarch) on Dec 14, 2005 at 14:46 UTC |