sub handle_connection { my $x = shift; my $sz = <$x>; print $x "Testing\n"; } #### Insted do as follows sub handle_connection { my $x = shift; while ( <$x> ) { print $x "Testing\n"; } }