Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: How to avoid an alphabet and integer next to it in a string?

by piscean (Acolyte)
on Mar 21, 2014 at 17:57 UTC ( #1079314=note: print w/ replies, xml ) Need Help??


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?

Yes, this is what I was looking for. Thanks! I tried avoiding H in C6H9. It turned out to calculate C69 giving me a wrong result. Of course, I was foolish enough to try this.


Comment on Re^2: How to avoid an alphabet and integer next to it in a string?
Re^3: How to avoid an alphabet and integer next to it in a string?
by piscean (Acolyte) on Mar 21, 2014 at 18:02 UTC
    my $molform = <STDIN>; $molform =~ s/[^a-zA-G0-9]//g; my $molmass = new Chemistry::MolecularMass; my $mass = $molmass->calc_mass("$molform");
      $molform =~ s/[^a-zA-G0-9]//g;

      Just eliminate the Hydrogen:

      $molform =~ s/H\d*//g;
        It says Forbidden chars. No output at all!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1079314]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2014-12-25 04:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (159 votes), past polls