$_ = 'CH4N2O'; print $_,"\n"; %hash = /([A-Z][a-z]?)(\d*)/g; while ( ($key, $value) = each %hash) { $value ||= 1; print "\t$key\t$value\n"; }