You are all correct of course and in an ideal world that would be possible. The link describing how to make use of CPAN is interesting reading but unfortunately there are situations when using code not part of a standard distribution is not viable.
I have coded what I need using nslookup and grep, split and substr.