http://www.perlmonks.org?node_id=217112

tachekent has asked for the wisdom of the Perl Monks concerning the following question:

O monks,
I have a serial device (a scrolling led sign to be precise) which I can send text to. It also has a buffer, which I can read the current length of. Both of these things I have managed to do in windows and freeBSD using (respectively) Win32::SerialPort and Dev::SerialPort.

I am trying to work out how to change the output (which should be the number of bytes in the buffer) into a readable form that I can test things against; From my windows monitoring it seems that the device is returning hex in the form:

00 3e
00 23
00 0c
etc...

I know this output to be the number of bytes in the buffer, however, when I capture it with $PortObject->read, and try to print it out I get unicode characters. I've tried using hex() and ord() but both convert all output to 0.

How can I convert my hex into decimal?