In my program I use Expect to run ssh. My program is
$argument="root@10.2.2.2";
$exp->spawn("ssh $argument") or die "Cannot spawn ssh to ip $ssh_ip_address\n";
But even if it is not able to spawn ssh it is not printing Cannot spawn ssh to ip $ssh_ip_address. Can you please help me understand why it does give the error message?