Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
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?

Replies are listed 'Best First'.
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 contemplating the Monastery: (5)
As of 2018-09-22 09:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Eventually, "covfefe" will come to mean:













    Results (190 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!