use IPC::Open2; print open2(\*IN, \*OUT, "telnet 10.65.2.252"); print OUT "Trying\n"; while () { $_ =~ s/10.65.2.252//; print; } close IN; close OUT; bash~$ perl test1.pl 26210Trying ... Connected to . Escape character is '^]'.