That's a lot of code.
Well, as for suggestions, use perltidy. Hopefully you see why.
if (!defined $match) {
print "$ip: ERROR_1\n";
print LOG "$ip: ERROR_1\n";
return;
}
...
if (!defined $match) {
print "$ip: ERROR_13\n";
print LOG "$ip: ERROR_13\n";
return;
}
...
sub get_inventory {
my ($ip, $t) = (@_);
if (!$t->cmd('terminal length 0')) {
print "$ip: Error changing terminal length\n";
print LOG "$ip: Error changing terminal length\n";
}
my @show_run = $t->cmd('show run | inc hostname');
...
Did you assemble this stuff from different sources?