in reply to perl dbi select question

Start by reading e.g. DBI SQL Query Question. Look at the question to see how to run query, how to iterate over results, etc. Then prepare proper select, which returns all rows you want to operate on, and voila!