I tried doing that, but I failed.
What did you try? How did it fail?
Hard to tell, but is all you are looking for this?
my $formula = 'C6H5OH'; $formula =~ s/H\d//g; print "$formula\n";
Update: As runrig suggests below the more general s/H\d*//g; may be more appropriate to your needs.
In reply to Re: How to avoid an alphabet and integer next to it in a string?
by hippo
in thread How to avoid an alphabet and integer next to it in a string?
by piscean
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |