in reply to Perl Script to Test Telnet Connectivity

Welcome to the monastery! :)

DISCLAIMER: I never used that module!

But it's obvious that your use of exists on scalar values is weird.

from this documentation of Net::Telnet ...

> When mode is "return" then the method generating the error places an error message in the object and returns an undefined value in a scalar context and an empty list in list context. The error message may be obtained using errmsg().

... I suppose you want to used defined instead.

FWIW: Another way is to keep the error-mode "die" and to catch the exception with a surrounding block eval (that's a try-catch in newest Perl).

Like that you'd get better diagnostics what went wrong.

Hope this helps! :)

Cheers Rolf
(addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
Wikisyntax for the Monastery

  • Comment on Re: Perl Script to Test Telnet Connectivity

Replies are listed 'Best First'.
Re^2: Perl Script to Test Telnet Connectivity
by redapplesonly (Sexton) on Nov 09, 2022 at 18:25 UTC

    It did help, and thanks Rolf. So the defined keyword is a new one for me, but it made all the difference here. This is an awesome site...! Thank you!