Postgres database and perl



I have a postgres purging perl script. Is there a way to connect to database at once and execute the above steps on different tables using perl?



Use Perl DBI:

use DBI;
my $dbh = DBI->connect($data_source, $username, $auth, \%attr);
$dbh->do($statement1);
$dbh->do($statement2);