in reply to Re^2: Forced to modify perl telnet script to use both telnet and ssh
in thread Forced to modify perl telnet script to use both telnet and ssh

Sorry I wasn't clear. We currently do have a working Perl/telnet script. Due to new security requirements we are moving to SSH. So, not all devices support SSH but will sometime in the future. Therefore I have to have a single script to handle both Telnet and SSH. (Lucky me). As stated, my dinosaur of a boss (he refuses to use new technology such as ZFS on Solaris) wants to "simply" modify the current script to handle both connections using the existing commands.
  • Comment on Re^3: Forced to modify perl telnet script to use both telnet and ssh

Replies are listed 'Best First'.
Re^4: Forced to modify perl telnet script to use both telnet and ssh
by philiprbrenan (Monk) on Sep 01, 2012 at 19:56 UTC

    Please go through your script adding statements like this:

    if ($device->{supportsSSH}) {SSH code} else {Telnet code}

    After a while you may notice that blocks of code keep getting repeated. Please consider refactoring them into sub {}'s as you work through your script.