http://www.perlmonks.org?node_id=118049


in reply to "switch$ia" but don't interpolate trailing "a"

Not that I am wiser, but:
my $host = "switch${i}a";
does the trick.