#!/usr/bin/perl use Net::SSH2; my $ssh2 = Net::SSH2->new(); $ssh2->connect('$HostName') or die "Unable to connect $HostName $@ \n"; $ssh2->auth_password('$user_id','$password') or die "Unable to login $@ \n"; my $chan = $ssh2->channel(); $chan->exec('ls -ltr') or die "Unable to execute the command $@ \n";