Eventually the while(1) will yield to the signal. It depends on the OS and how perl works. It may not be immediate. In Linux/UNIX signals are only delivered to a program when it "wakes up"; that is, when it starts to run after having let another process use the CPU.
True, select "blocks" until input. Your
while(1){}; just consumes the CPU until input happens.
In the C code if data comes to the port while printf is printing, the printf may be interrupted for the signal and the flag would be set indicating data were present. That is why the STOP==FALSE test is there.
Since you have the while(1) loop and it is empty in your example, you could do something like:
while(1){
wait for input via select
process input
}