#!/usr/bin/perl
use strict;
use DBI;
open(PH,">ips");
my $dbh=DBI->connect ("DBI:mysql:test:127.0.0.1:7096","root","pass") or die "can not connect to the database $DBI::errstr"; #test is the table,127.0.0.1 is the host and the port 7096.
my @data;
my $tmp;
my $sth=$dbh->prepare("select * from misc_gateways where ips<>?");
$sth->execute("") or die "Error".$sth->errstr;
while(@data=$sth->fetchrow_array()){
print PH $tmp."'";
}
print "\n";
print PH."\n";
$dbh->disconnect();
close(PH);