in reply to Re^3: How to open nested SSH connection using perl
in thread How to open nested SSH connection using perl

how about my second question? are tunnels enabled on the gateway machine?

Also, which version of the ssh client is installed on the machine where you run the Perl script.

Update: in order to check if port forwarding is enabled, run the following command:

ssh serverA -W serverB:22
replacing serverA and serverB by the real hostnames or IPs.

If you get a response similar to...

SSH-2.0-OpenSSH_6.7p1 Ubuntu-5ubuntu1
it means that port forwarding is enabled.