Quoth [email protected] (Paul LeoNerd Evans):
> -=-=-=-=-=-
>
> On Wed, Apr 22, 2009 at 02:10:03AM +0100, Ben Morrow wrote:
> > What am I missing here? It appears to me unpacking "." gives the current
> > byte position in the string, which is what is needed.
> >
> > ~% perl -E'my $bin = pack "NN", 10, 12; say for unpack ".N.N.", $bin'
> > 0
> > 10
> > 4
> > 12
> > 8
>
> Ah, youknow, that is exactly what I wanted :)
>
> I had in fact looked up and down the docs for a format which would do
> something like that, and didn't find it. Is that documented anywhere?
>
> I've just sat and reread perldoc -f pack and perldoc -f unpack _again_
> and still haven't spotted it.
It appears (see Peter's reply) that it is only implemented in 5.10.
5.10's perldoc -f pack includes
. Null fill or truncate to absolute position specified by value.
which (besides being rather terse) doesn't explicitly say that unpack
"." will do what it does.
Ben