while(1) { open( COM, "/dev/ttyUSB0") or die "Can't read serial port : $!\n"; while() { # stuff } close(COM); sleep(1); }