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:

               ·       You must yourself do any alignment or
                       padding by inserting for example enough
                       `'x''es while packing.  There is no way to
                       pack() and unpack() could know where the
                       bytes are going to or coming from.
                       Therefore `pack' (and `unpack') handle
                       their output and input as flat sequences
                       of bytes.

-spp

Reply via email to