Hi
I'm still not getting the result i require please could someone have a
quick look and see what i'm missing ...
the following code is suposed to break up the looked info from dns
server so I can manipulate it.
It dies with the following errors when it reads more than one line
from the database ....
Can't call method "fetchrow" without a package or object reference at
./test.pl line 13.
<code>
#!/usr/bin/perl
#$test = "15-Nov-2006 14:11:06.304 update: info: client
196.211.85.42#35435: view external: updating zone
\'goal.lek.linserv.co.za/IN\': add
use Mysql;
$dbh = Mysql->connect('localhost','syslog_ng','root','')
or die("Error " . $dbh->errno . " - " . $dbh->errstr);
$query = $dbh->query("SELECT msg FROM logs where program = 'named'; ")
or die("Error " . $dbh->errno . " - " . $dbh->errstr);
while (@row = $query->fetchrow){
#chomp ;
#if ($test =~ /^(\d+)-(\w+)-(\d+) (\d+):(\d+):(\d+).*?client
(\d+)(.\d+)(.\d+)(.\d+)#(\d+): view external: (.*)$/){
$_ =~ tr/'//d ;
if ($row[msg] =~ /^(\d+)-(\w+)-(\d+) (\d+):(\d+):(\d+).*?client
(\d+)(.\d+)(.\d+)(.\d+)#(\d+): view external: updating zone (.*)$/){
$day = $1;
$month = $2;
$year = $3;
$hour = $4;
$minute = $5;
$second = $6;
$clientip = $7;
$clientip .= $8;
$clientip .= $9;
$clientip .= $10;
$port = $11;
$query = $12;
print("day is $day\n");
print("month is $month\n");
print("year is $year\n");
print("hour is $hour\n");
print("minute is $minute\n");
print("second is $second\n");
print("clientip is $clientip\n");
print("port is $port\n");
print("query is $query\n");
print("\n");
}else{
print("malformed log entry: $_ \n");
}
</code>
$test is a sample of the syntex.
On 11/16/06, Gregory Machin <[EMAIL PROTECTED]> wrote:
Hi
I need to remove all the quotation marks from, a string
I tried s/\'// but it did not work.
what have i missed ??
Many Thanks
--
Gregory Machin
[EMAIL PROTECTED]
www.linuxpro.co.za
--
Gregory Machin
[EMAIL PROTECTED]
www.linuxpro.co.za
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>