Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Running Perl Scripts


ghost's Avatar
0 0

hello

Well, Im here today to find out how to keep a perl script open in command prompt after I run it. If I wanted it to close I would close the window.

If I was to run this script:

use strict; 
use warnings; 
use Net::DNS; 
use NetAddr::IP;

my $ip = new NetAddr::IP (shift) || die "Unable to create NetAddr::IP object\n"; 
my $res = Net::DNS::Resolver->new;
my $num = $ip->num();

for (my $i=0; $i<=$num; ++$i) { 
	my $ip_address = $ip->addr();
	
	if ($ip_address) {
		my $query = $res->search("$ip_address");
		if ($query) {
			foreach my $rr ($query->answer) {
			next unless $rr->type eq "PTR";
			print "$ip_address,",$rr->ptrdname, "\n";
			 }
		} else {
			print "$ip_address,",$res->errorstring,"\n";
		 }
	}
	++$ip;
}```

and I run:
perl Reverse-DNS Lookups.pl 00.000.000.000 (ip of website)

it will just close. And I got this source code from: [http://geekpit.blogspot.com/2006/03/perl-s...everse-dns.html](http://geekpit.blogspot.com/2006/03/perl-script-that-does-bulk-reverse-dns.html)

But I wanted to type it out.

Anyways. Please help!

Thanks in Advanced.

ghost's Avatar
0 0
  1. On what OS are you trying to run it?
  2. Doesn't it give debug info after running it?
  3. The first line should be "#!/usr/bin/perl" , i don't see the # in yours :).

ghost's Avatar
0 0

yeah I got it to work.. Im using on a windows machine so yeah- that was the problem.. I had to point it to perl.exe LOL.

Thanks.