In default conditions, this will wait until it has collected one line of input (i.e. everything up to $/, the input record separator) before returning control to the program. To avoid this behaviour, have a look at
(the four argument version) to poll file descriptors to see whether or not they have input waiting to be read, and have a look at
which has an item on nonblocking IO. This last is also a good search string to find information on avoiding blocking on reads.