while (my $msg = ) { print $sock "$msg\n"; } close $sock;