in reply to
Win32::SerialPort code hanging while reading a 'line'
I know nothing about the module you use, but maybe closing and reopening the filehandle as soon as the loop in write_pd_data receives only empty strings for a while, might work.
Comment on
Re: Win32::SerialPort code hanging while reading a 'line'
In Section
Seekers of Perl Wisdom