foreach my $table( @some_list_of_tables ) { ## some code to read another .ini file into $config where ## the sections are cols and the k=v pairs are user=new_val ## ## (for example!) foreach my $col (sort keys %$config) { my $sql = qq{ update $table set $col = ? where user = ?}; my $sth = $dbh->prepare( $sql ); while (my ($user, $new_val) = each %{$config->{$col}}) { $sth->execute( $new_val, $user ); } } }