http://www.perlmonks.org?node_id=1079354


in reply to Re: How to avoid an alphabet and integer next to it in a string?
in thread How to avoid an alphabet and integer next to it in a string?

Thanks Ken! It was really helpful :) I've used Chemistry::MolecularMass module to have precise atomic weights.

Replies are listed 'Best First'.
Re^3: How to avoid an alphabet and integer next to it in a string?
by kcott (Archbishop) on Mar 21, 2014 at 21:00 UTC

    I haven't used Chemistry::MolecularMass previously (in fact, I wasn't aware of its existence until now); however, looking at its documentation, it would appear another (completely untested) solution would be:

    use Chemistry::MolecularMass; my $mm = Chemistry::MolecularMass::->new(); $mm->replace_elements(H => 0); my $no_H_mass = $mm->calc_mass($your_formula);

    -- Ken