Quoth Perl User <>:
> Hi,
> Here's my problem:
>
> I read encrypted data from a server and save it in a variable. Now, I need
> to send this back to the server along with a number that tells how many
> bytes long the binary data is.
>
> I've tried
> $x = read_data_from_server($args);
> $y = length $x;
> send_data_to_server($x,$y);
>
> I am not sure if the length function is the right way to count the number
> of bytes in the string $x. Can someone please show me how to do this?
It is, provided you've told perl that your data is binary not textual.
Make sure you use binmode on the socket filehandle.
Ben
--
If you put all the prophets, | You'd have so much more reason
Mystics and saints | Than ever was born
In one room together, | Out of all of the conflicts of time.
The Levellers, 'Believers'