in reply to How to avoid an alphabet and integer next to it in a string?
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 Section
Seekers of Perl Wisdom