#code to send data to port syswrite(COM,$string); #sends $string to COM1 #code to read data from port sysread(COM,$buf,$length); #read $length bytes $received = unpack("C*",$buf); #unpack them