Today I found that Device::SerialPort was causing the core dump. The "exit" command called by a button did not entirely end the serial communication going on and that caused the core dump. I added some lines of code so that the button only chaned a variable and based on that variable a "disconnect" and "exit" command was issued from within the main subroutine -- the dumping of core stopped! Many thanks to all for the suggestions and help!!!