Hi, everybody, thank you for your attention on this problem. Finally I got the root cause. The reason is that the Linux kernel is configure to use console as standard output. And at the time when the perl is running the serial port is stuck. So the perl script hangs.
Re^4: print() function hang for long time