To implement the entire Telnet protocol (or a subset of it), username and password is just the first issue you are facing. So the level of difficulty is higher than you thought. To install Net::Telnet is a much easier way out.
If you really want to go down the path to implement yourself (for whatever purpose, might be a good learning experience), you first need to get familiar with Telnet protocol, maybe read its specification first (RFC 854).
For your direct issue: yes, you cannot specify password and username when you create TCP socket, as TCP socket never defines those concept (actually not even Telnet). Username and password are tranfered by the Telnet protocol (which is build on top of TCP) as data.