in reply to Keeping an eye on your wiki articles

Rather than selecting all the rows from your database and filtering them in your Perl program, it would seem to make more sense to filter the data in the database (that is, after all, what databases are good at). Your database also knows what the current date is, so your Perl program doesn't need to :-)

The code might look something like this:

my $sql = 'select page_title, page_touched from proadvpag where page_namespace = 0 and page_is_redirect = 0 and page_touched < NOW() - INTERVAL 100000000 SECOND'; my $sth = $dbh->prepare($sql); $sth->execute($then); while (my $row = $select->fetchrow_hashref) { # all rows returned are ones you want to send an # email about }

It's well worth getting to know the date handling functions in your database (indeed, all the functions in your database) as they can often make your life easier.

Incidently, even if you don't go down the SQL route, your task of constructing a timestamp will become far easier if you use POSIX::strftime.

--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg