in reply to Assistance please
Hi, R3volution, and welcome to PerlMonks!
Perhaps the Module Chemistry::MolecularMass would be helpful to you. The following example, but using H2O, was adapted from the Module's site:
use strict; use warnings; use Chemistry::MolecularMass; my $chemical = 'H2O'; my $mm = new Chemistry::MolecularMass; my $mass = $mm->calc_mass($chemical); if ( defined $mass ) { print "The mass of $chemical is: $mass"; } else { print "Unable to calculate the mass of $chemical"; }
Output:
The mass of H2O is: 18.01528
|
---|
In Section
Seekers of Perl Wisdom