thanks pc88mxer,
for your comments. your right that the $host is tainted and i've fixed the issue. whats more,
my $fh = new IO::File "$NSLOOKUP -type=any $host 2>&1 |";
is same as
open(my $fh, "-|", $NSLOOKUP, "-type=any", $host)
however only difference from the two is that yours is more optimised than mine. so i've decided to use yours.
if your have more ideas of improvement or security issues please let me know.