This is OT, please refer to a correct group.  A good place to start would be
groups.google.com in comp.lang.perl.misc

Ilya

-----Original Message-----
From: Bryan Tolka
To: Dbi-Users
Sent: 2/19/02 5:12 AM
Subject: script --- very basic

Hello everyone. I have a script below that opens another file 
checkdns.pl and executes a while loop. I would like to pass it a 
variable $dnsName. This however seems to be eluding me and my poor 
scripting abilities. The checkdns.pl script works when executing the 
file itself. Is this the correct syntax for passing a variable?
Thanks any help is appreciated.


####### update.pl file #########

if ( ($oldip eq $ip) && ($os ne "router") && ($os ne "hub") && 
($bootType ne "conduit") ){
open (DNSQeury,"./checkdns.pl $dnsName");
while (<DNSQeury>){
if ( (/(\d+\.\d+\.\d+\.\d+)/) && ($dnstest ne $ip) && ($bootType ne 
"reserved") ){
print "<strong>DNS name $dnsName, already assigned to $dnstest, added 
nothing</strong>";
exit;
}
print " DNStest is $dsntest";
}
}


### checkdns.pl file #######

#!/usr/bin/perl
print"Content-type: text/html\n\n";
use DBI;
$dbh = DBI->connect("DBI:mysql:netmgt:localhost","root","spider");
#print "enter dnsname ... " ;
$dnstest=<STDIN>; ## input
#chomp ($dnstest);
$sth=$dbh->prepare("select ip from ipmgt where (dnsName = '$dnstest')");
$sth->execute;
$rv= $sth->rows;
print "Number of records found:$rv\n"; ## Testing purposes
$sth->finish;
$dbh->disconnect;
exit;

Reply via email to