Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Assistance please

by Kenosis (Priest)
on Nov 21, 2012 at 20:57 UTC ( #1005010=note: print w/replies, xml ) Need Help??

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"; }


The mass of H2O is: 18.01528

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1005010]
[shmem]: Discipulus: the <<>> operator is quite new, it is in perl5.24 for instance
[Discipulus]: ah! thanks shmem it works in strawberry 5.24
[shmem]: ah. Introduced in 5.22.0, see perl5220delta
[Discipulus]: if so the previous error is a bit misleading, anyway
[shmem]: well, previous to that << was always treated as the left-shift operator
[Eily]: or the here-doc operator
[Eily]: which is actually how it is parsed in this case
[shmem]: older versions of perl can't guess that "use of <<>> may be implemented someday" :D
Discipulus how much wise my brothers are? ;=)

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2017-07-21 09:05 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (320 votes). Check out past polls.