my $n = unpack("v", $str); $str = substr($str, 1);