in reply to Raw socket Connection.
This is usually not what people understand when you say "raw socket".
Most likely you want to look at Net::SSH2.
Also see How to connect to raw socket