in reply to Is this a bug or am I insane/stupid/ignorant/etc

$host2 is set to 0. You've made a bareword. Turn on strict and warnings, and you'll see the problem. You could also print it to see: print "($host2)\n";

You have to quote strings.