in reply to File/Data Streaming over a socket

If this is going to be production code you should use one the many excellent CPAN modules. Consider that in error conditions your code could lockout the rest of the system or corrupt files.

For education purposes Perl's <> operator may do what you want.

while (defined($line = <SOCK>)) { print $line; }

If not perlfaq8 has a full server example.

s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}