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. So it would appear no changes to perl code are needed, though perhaps the docs could be improved somewhat to draw more attention to this, as relatively few people are aware of it. Certainly nobody in Freenode's #perl was when I asked... -- Paul "LeoNerd" Evans [email protected] | CPAN ID: PEVANS srand($,=" ");print sort{rand>0.5}grep{0.8>rand}qw(another Just hacker of Perl)
signature.asc
Description: Digital signature
