in reply to use of telnet in perl

but it is not working

Please explain what is not working: do you get any output, is output different from what you wish, or what?

It would also be good to get a sample of your input file.