I have a string of pack
ed values which was created sequentially using something like:
while (...) {
...
$packed .= pack( 'L', $val );
}
In another program, after I load $packed
, I wish to find out how many values were actually packed. I know how to do that after unpack
ing:
my @vals = unpack( 'L*', $packed );
print scalar(@vals);
But is it really necessary? If I only care about the number of values, can I do better and skip the unpack
ing?