... my $name =; print $sock $name; # $name still holds the newline you got from STDIN