You are looking at a very old, but free version of the course. If you are interesed the most recent version, check it out on the Perl Maven site.

8.9. ssh using Net::SSH

Wrapping the external ssh command. Therefore working only in UNIX/Linux.
See also Net::SSH::Perl.

Example 8-7. examples/network/ssh.pl

#!/usr/bin/perl
use strict;
use warnings;

use Net::SSH qw(sshopen2);
use IO::File;
my $output = IO::File->new;
my $input  = IO::File->new;

sshopen2("localhost", $output, $input) or die $!;

print $input "set\n";
print $input "echo DONE\n";
print $input "who\n";
print $input "echo DONE\n";
print $input "date\n";
print $input "echo DONE\n";
print $input "cat README\n";
print $input "exit\n";

my @out = <$output>;

my $c=0;
my @section;
while (my $line = shift @out) {
    if ($line =~ /^DONE$/) {
        $c++;
        next;
    }
    push @{$section[$c]}, $line;
}
foreach my $sect (@section) {
    print @$sect;
    print "--------------------\n";
}

If you are interested in on-site trainings by the author, please contact me directly.