Can charge groups be assigned by Perl Script?

Hi all,

When assigning charge groups manually, it is tedious if there are too many groups that are exactly the same to be assigned(for example, I have 50 hydroxyl groups and I wish to assign each of them as a charge group). Is it possible to write a script to automatically assign those repeated groups?

Cheers,

Bruce