in reply to Re^4: How to sort record using pack function ?
in thread How to sort record using pack function ?

The example code in my first reply was based on certain assumptions, in particular, that the data you are dealing with is raw binary. My example code may have no bearing on the actual problem you face.

$length = unpack "C4", substr $data,0,2,'';

As to your code, my interpretation is:

This doesn't really seem to make a lot of sense. See code example below.

>perl -wMstrict -le "my $data = 'ABCDEF'; my $len = unpack 'C4', substr $data, 0, 2, ''; print $len; print qq{'$data'}; " 65 'CDEF'