in reply to Set a variable to remote information
Not what you asked, but line 8, chop($domain); is not what you should do. chomp is better, chomp( my $domain = <STDIN>); will replace lines 7 and 8.
After Compline,Zaxo