Q&A > network programming > How do I send a file through a Socket Connection ? - Answer contributed by chromatic
Disabling buffering ($| = 1) might be a good idea. You can also call select on the $connection object.open(INPUT, $my_file) || die "Can't open: $!"; print $connection while (<INPUT); close(INPUT) || die "Can't close: $!";
On the server side, you can just read from the socket (once it is set up) with the normal angle operators. Using the accept() method will cause the server to listen to the socket until it gets a response, and it will return an object with filehandle properties. Whatever you want to do with it from there is up to you, once it's in a scalar or an array.