in reply to Reverse IP Lookup

The original code from http://www.stevekallestad.com/blog/reverse_ip_lookup_using_perl.html is:

#!/usr/bin/perl use strict; se warnings; use Net::IP; use Net::DNS; my $ip = new Net::IP($ARGV[0],4); print $ip->reverse_ip()."\n"; print "Resolving ...\n"; my $res = Net::DNS::Resolver->new; my $answer = $res->query($ip->reverse_ip(),'PTR'); my $namer = $answer->{'answer'}[0]; print "PTR Name: $namer->{'ptrdname'}\n";

@ARGV is a special variable that contains the parameters passed to the script. In the script you copied the ip was passed as a command line option. In your case it is in the variable $a, so you must use this variable in the call to new Net::IP like this:

my $ip = new Net::IP($a,4);

You better don't change the @ARGV variable at all.

BTW, when you write:

my $ARGV = $a;

You are assigning the scalar variable $ARGV. And when you write:

my $ip = new Net::IP($ARGV[0],4);

You are using the array variable @ARGV (its first element)

citromatik