in reply to Piping sockets to STDIN

Hi foxops,

While you are probably better off, from the point of maintanability and readability of your code, to explicitely write to and read from your sockets, as in l2kashe's code above, you could start playing typeglob games to alias STDIN and STDOUT to your socket filehandles. Below is an example with regular files:

use strict; open INPUT, "<flea.txt" or die "Blerch: $!\n"; open OUTPUT, ">camel.txt" or die "Hcrelb: $!\n"; local *STDOUT=*OUTPUT; local *STDIN=*INPUT; while (<STDIN>) {print}
This will copy the input file to the output file. The local is not strictly necessary, but is certainly nicer. This way, you can locally alias STDIN and STDOUT to your sockets without changing the rest of your code.

Oh, and to get simple sockets to telnet you can write to and read from without necessitating the various telnet control codes, you will probably have to use something like Net::Telnet, again as l2kashe said.

CU
Robartes-