my $buffer = read ...; my $len = get_int32($buffer); my $cmd = get_int8($buffer); my $txt = get_string($buffer);