Kenneth Moeng wrote:
Hello there, I have a problem with property definition of this code,
please have a look.
This code will never run without errors, you only declare two out of
several variables. Why would you send broken code to the list to
illustarate a problem it will never be able to?
#!/usr/bin/perl -w
Ditch the -w since you have use warnings...
use DBI;
use strict;
Excellent!
use warnings;
Excellent!
$dsn = "dbi:mysql:db_coolcash:localhost";
my $dsn = ...
Also use single quotes when not interpolating anything.
my $user= "mysql";
single quotes
my $password = "mysql123";
single quotes
$dbh = DBI->connect($dsn,$user,$password);
my $dbh...
and check for failure:
or die "Could not connect: " . DBI->errstr();
$msg = $ARGV[1];
my $msg ...
$source = $ARGV[0];
my $source ..
$msg =~ s/\\\"/' /ig;
$time = localtime();
open (OUTFILE ,">>C:\\logs\\cool.txt");
check for failure (or die "Could not open cool.txt for appending: $!";)
print OUTFILE "$time\t$source\t$msg\n";
close(OUTFILE);
...
exit;
No need for exit;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>