thanks
Guy
Here is the script:
Expand|Select|Wrap|Line Numbers
- #!/usr/local/bin/perl
- use strict;
- use warnings;
- use DBI;
- my $num=226;
- my $dbh = DBI->connect("dbi:mysqlPP:database=iplocation:host=localhost","root","*********",{'RaiseError' =>1});
- my @ranges = $dbh -> tables;
- open(my $out, ">", "output.txt") or die "Can't open output.txt: $!";
- for(my $i=2; $i<(@ranges); $i++)
- {
- my $sth = $dbh -> prepare (qq{select * from $ranges[$i] where country = $num});
- $sth -> execute ();
- print "checking table $ranges[$i]\n";
- while (my $ref = $sth->fetchrow_arrayref())
- {
- print $out "IP address is $ranges[$i].$ref->[0].$ref->[1]\n";
- $sth->finish();
- }
- }
- close $out or die "$out: $!";
- $dbh->disconnect ();
Here is the last entry in output.txt where the code hangs:
$ tail output.txt
IP address is ip4_0.255.212
IP address is ip4_0.255.213
IP address is ip4_0.255.214
IP address is ip4_0.255.215
IP address is ip4_0.255.216
IP address is ip4_0.255.217
IP address is ip4_0.255.218
IP address is ip4_0.255.219
IP address is ip4_0.255.220
IP ad
What is strange is that it doesn't complete the print of IP address is
thanks
Guy