foreach my $handle1 (@read_from) { our $buf; local *buf = \( $buf{fileno($handle1)} ); # alias $buf = '' if !defined($buf); my $rv = sysread($handle1, $buf, 64*1024, length($buf)); # Handle error if !defined($rv) # Handle eof if !$rv while ($buf =~ s/^(.*\n)//) { print $1; # Full line at a time } }