----- Original Message -----
From: "Kwon SoonSon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, March 03, 2002 19:32
Subject: converting php to perl


> And the perl script is
>
> ----
> #!/usr/bin/perl -w
>
> use DBI;
> use strict;
>
> my $dbh = DBI->connect('DBI:mysql:foo', 'bar', '') or
> die "Cannot connect to server\n";
>
> my $sth = $dbh->prepare("SELECT * FROM T_Comments");
>
> $sth->execute;
>
> my @A;
>
> while (@A = $sth->fetchrow_array) {
>         if ($A->Author && $A->AuthorEmail)
>                 $dbh->do("UPDATE T_Comments SET score
> = 1 WHERE Rid = '$A[Rid]'"
> );
> }
>
> $sth->finish;
> $dbh->disconnect;
>
> exit(0);
> ----
> Could anyone please let me know where to modify?

Look for fetchrow_hashref in the fine manual (perldoc DBI).  'perldoc
perlreftut' and 'perldoc perlref' may also be interesting to you.
--
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.

Reply via email to