in reply to How much was unpack()ed?

The problem here seems to be that unpack does not have a formatter similar to %n of scanf. You might try to use a regexp instead for matching a zero-terminated string, while still using pack for the other types. Then, you can use pos or $+[0] to find out how much you've read.