Having a second look I see the problem
You don't need the call to run_ssh.
This should work for you
#!/usr/bin/perl
use strict;
use warnings;
use Net::SSH::Expect;
use lib ('./subs');
use subs;
my $ssh = Net::SSH::Expect->new (
host => '10.77.6.55',
password => 'mypass',
user => 'root',
debug => 1,
raw_pty => 1
);
my $login_output = $ssh->login();
if ($login_output !~ /Last login/) {
die "Login Failed\n";
}
$ssh->exec("stty raw -echo");
print "Running ls -l\n";
my $ls = $ssh->exec("ls -l /");
print "ls = $ls";
$ssh->close();