in reply to variable not passing

Use
my $client = gethostbyaddr(inet_aton($addy), AF_INET); # get name
instead. You'll findthat if you used "111.11.111.111" instead of 111.11.111.111 (note the quotes), you would have gotten the same result. But it turns out that perl handles dotted quads (or actually any dotted decimals) as a particular kind of string constant (called a Version String, search for it in perldata for more info) that doesn't need processing through inet_aton.