<p>How do you calculate the length of the string that would be returned by Array::pack?  Is there something like Python's calcsize?</p>

By making an interpreter complying to the specifications found in
Array::pack
.
Or, reusing the existing implementation to count the number of characters instead of appending them to a string.