when running below mentioned script i am getting the following error
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.
this is the script:
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',m +guvvala,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');

In reply to Can't call method "exec" without a package or object reference by rahul.pwav

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.