I have a string like this,
str = "uu@p, xx@m, yy@n, zz@m"
I want to know how to convert the given string into a hash. (i.e my actual requirement is, how many values (before the @ symbol) have the m, n and p. I don’t want the counting, I need an exact value). The output would be better like this,
{"m" => ["xx", "zz"], "n" => ["yy"], "p" => ["uu"]}
Can help me anyone, please?
Direct copy/past of an IRB session: