Subject: escaping @
I'm sure this is very simple and I am overlooking something. I want to
read a list of bad email addresses from a file and remove them from my
database.
If I print $_, the email addresses are correct, if I try to remove them
from the db I get errors on just the characters before the @.
Here is what I have:
==
#!/usr/bin/perl -w
use strict;
use DBI;
use DBD::Pg;
my $infile = $ARGV[0];
open( INFILE, "<$infile" );
while( <INFILE> ) {
my $dbh = DBI->connect("dbi:Pg:dbname=*, "*", "*") || die;
#s/\@/\\@/;
#print $_;
my $sth = $dbh->prepare("UPDATE
table
SET
email = ''
WHERE
email = $_ ") || die;
$sth->execute;
finish $sth;
$dbh->disconnect;
}
close( INFILE );
==
Please try...
<snip>
open( INFILE, "<$infile" );
my $dbh = DBI->connect("dbi:Pg:dbname=*, "*", "*") || die;
my $sth = $dbh->prepare(q{UPDATE table
SET email = '' WHERE email = ? "}) || die;
while( <INFILE> ) {
$sth->execute($_);
...
</snip>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>