in reply to
Forced to modify perl telnet script to use both telnet and ssh
"depending on the response from the devices." What response? This is probably the most confusing aspect.
"has some differences from true CPAN" - Yes, even you can use CPAN (I expect CPAN modules to still be installable - we do it all the time with the system perl on AIX, so I don't see why openCSW would be worse).
Though, honestly, I prefer ssh over telnet anyway. It's just so easy to run "ssh user@host 'my command here'". But if you need to do both, I'm guessing that you can run "ssh user@host" nearly the same way as you telnet to the host. The major differences are at the beginning: the user won't be asked for, and the password prompt might be different (or not exist at all if you have an ssh key set up properly).
At $work, I use our own ssh wrapper to handle parallelism (using AnyEvent), ssh tunnels, multiple hops (ssh to A, and use that to ssh to B under the ssh key credentials available on A), etc. I didn't find it terribly difficult - at least, not the ssh parts. Unfortunately, your problem description remains a bit vague, so I don't know where to start in sharing.