root@LST12:/home/rkumar# perl ssh.pl success Opned ssh channel to 10.131.24.157 success Opned ssh channel to 10.131.24.106 Can't call method "exec" without a package or object reference at ssh.pl line 31. #### use Net::SSH::Expect; sub OpenSshChnl { $hst = shift; $pass = shift; $UN = shift; my $ssh = Net::SSH::Expect->new ( host => $hst, user => $UN, password=> $pass, raw_pty => 1, # timeout => 10 ); my $login_output = $ssh->login(); if ($login_output !~ /Last login:/){ die "Login has failed. Login output was $login_output"; } else { print "success \n" } print "Opned ssh channel to $hst\n"; } @sys = (UE,'10.131.24.157',mguvvala,abc123,12345,eNb,'10.131.24.106',mguvvala,abc123,12345); $ssh_UE1 = OpenSshChnl(@sys[1],@sys[3],@sys[2]); $ssh_eNb1 = OpenSshChnl(@sys[6],@sys[8],@sys[7]); $ssh_eNb1->exec('iperf -s -u -i 1 -p 12345 -o log.txt'); my $client = $ssh_UE1->exec('iperf -c 10.131.24.106 -u -b 10M -i 1 -t 1 -p 12345');