Perl Telnet

These sites are FOR SALE: miscperlinfo.com, mpihowto.com!
If you are interested, please use my Contact page.




Perl Telnet represents an opportunity to use telnet protocol in Perl.

Telnet is a network protocol you can use in order to make a connection with another computer on the Internet or local area network (LAN).

A discussion about pros and cons in using this protocol in establishing a connection between two computers is beyond the scope of this page.

If you want to use Perl Telnet, perhaps you have your own reasons (let’s say you want to telnet some servers in order to log on and verify the connection with each of them), so I will explain what options you have in using telnet from a Perl script below.


Click Below to See the Best

Perl How-to Snippet Collection

and Save Hours of Surfing on Internet!


The straightforward way to do this is by using a module which can provide an interface necessary to connect through the telnet protocol. We recommend you to use the module Net::Telnet, available at CPAN. Made by Jay Rogers, this module is a free software and can be redistributed and/or modified under the same terms as Perl itself.

You can use the Net::Telnet module to create a telnet client able to make connections through a TCP port to a server. Be sure that on the other end of communication line the server you are connecting to have an authentic Telnet protocol, otherwise some problems could appear. It’s the case of some remote ms-windows machines which come with a built-in telnet protocol that do not use the ASCII characters CR and LF to start a new line, which is essential for a "genuine" telnet protocol.

Besides traditional methods like print, get and getline, because the telnet protocol implies human interaction, some specific interactive features have been added: the ability to specify a timeout, to wait until some patterns will appear in the input stream, etc.

Using this module you have at least some opportunities:

  • communicate with another host using a telnet port and implement some particular routines to help you log on
  • getting a simple way to make connections to tcp services, without the hassle of using sockets
  • ability to set your own timeout for the connection, read and write operations
You can download this module at CPAN, accessing the page:

Net::Telnet module for Perl Telnet

However, before downloading this module (for Perl Telnet), you must make sure that your Perl version is compatible with that of the module (at least Perl version 5.002, or 5.003_07 for windows machines).

A-N-Y-O-N-E Can Learn and Master Perl!
And That Includes YOU!


Check these how-to tutorial eBooks (PDF format):


Related links:

return to Internet Programming Perl