in reply to Re^7: 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?

chomp(my $molform = <STDIN>);
  • Comment on Re^8: How to avoid an alphabet and integer next to it in a string?
  • Download Code

Replies are listed 'Best First'.
Re^9: How to avoid an alphabet and integer next to it in a string?
by runrig (Abbot) on Mar 21, 2014 at 19:20 UTC
    Forget chomp, just do:
    $molform =~ s/\s+$//;
      $molform =~ s/H\d*//g; worked for me except for Hg and He. Yup, I tried $molform =~ s/\s+$//;

      The output is zero