chomp( my $greet = <$sock> ); die if $greet ne 'HELLO 1.0'; print $sock "HELLO 1.0"; ...continue...