use threads;
use Net::SSH::Perl;

my $host = 'hostname';
my $user = 'root';
my $password = 'root123';

my $thread = threads->new (\&ThreadEntry,"ls");
my $thread1 = threads->new (\&ThreadEntry,"ls -al ");

sub ThreadEntry()
{
    my $ssh = Net::SSH::Perl->new($host, 35903);
    print "in ssh function \n";
    my($stdout, $stderr, $exit) =$ssh->cmd(@_);
    print "$stdout $stderr $exit\n";
}

$thread->join();
$thread1->join();

After running this program

Segmentation fault (core dumped)

Related posts

Recent Viewed