Win7 x64, Arduino Uno: com port gets disabled after use

I was about to test it but then I realized the bug is in the sketch, after all. I declare "val" (where I read in the commands) as a single char, because originally my serial commands were 1-char long. But I then switched to 2-char long commands, without changing the val declaration. So now the second 2-char command runs over the declared length and (presumably) locks up the Uno. I changed the val declaration to "12345678" and I added "Serial.flush;" once I've read in the command. Everything works again. Thanks for helping me along.

One more question. I issue the serial commands from a Perl script. It seems that Arduino's Serial Port Monitor and my Perl script don't play along. That is, if I use the Serial Port Monitor, I can access the serial port as much as I want. But once I've quit out of the Monitor the port becomes inaccessible to my Perl script. I have to uninstall the port and re-scan for new hardware. Then it becomes accessible to the Perl script. But if I try to launch the Monitor after using my Perl script, the Arduino IDE locks up. It's not a big issue, because, in the end, I'll only be using the Perl script. I'm just curious why this is the case. I realize that a serial port cannot be used by software A and B at the same time, but it should be possible to access the port from software B, once software A has been closed.