Question

I am having difficulty trying to understand some data.

I have a Perl Script and all I know about that script is that it is sending some data packets over the network.

When I debug through the script the data that it sends looks like following: "KFD!P#"

I am very new to Perl and all I know is that it should be a Byte[]. Should I not see something like \dsdsds \dssds if it is a byte array?

Is this string represented in any expression that I am not able to understand?

Any ideas?

Was it helpful?

Solution

To print the contents of a perl string that is being used as a buffer, you need to convert it to a printable form first. Use unpack for that.

For example to convert it to a string of hex digits:

print unpack('H*', $buffer),"\n";

Read perlpacktut to learn more.

OTHER TIPS

Run wireshark to see what it is putting over the wire.

Any string can be considered a byte array so you won't need any keywords like "byte" in the code.

Sharing the code somewhere or some portion of it would provide more context to work with and address your question.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top