$ip = ; # Remove the trailing newline ... chomp $ip; . . . # Make sure your connection opened my $ssh = Net::SSH::Perl->new($ip) or die($!);