in reply to Shortening Execution Time

use is evaluated before your code is executed so the single use inside an if block is effectively global to everything. It is better to put use statements at the top of your script where they can easily been seen and their visibility is a better match to their scope. If you want to optionally "use" a module, use require instead.

$host is not initialised before it is used in the die statements. Using strictures would detect the problem the first time you tried to run the code. Tip: always use strictures (use strict; use warnings; - see The strictures, according to Seuss).


Perl reduces RSI - it saves typing