On Thu, May 24, 2001 at 10:58:38PM -0400, Stephen P. Potter wrote:
> Lightning flashed, thunder crashed and chris brown <[EMAIL PROTECTED]> whispered:
> | I would prefer to write each record using pack, but I
> | can't see how to elegantly get pack to zero-fill
> | without using sprintf.  And I kind of feel like once
> | I'm using sprintf I might as well ONLY use sprintf for
> | the whole record.  And *that* doesn't feel very
> | Perlish to me, so I suspect there's a different
> | solution.
> 
> Nope, pack works on bytes.  If you want to pad your output, you need to use
> something like sprintf.  See perlfunc:

What exactly feels "unperlish" about sprintf?  Perl is all about using
the right tool for the right job, and sprintf imho is the right tool
for zero-filling.

If you insist on doing it without sprintf, there are some alternatives
in perlfaq4.

Walt

Reply via email to