![]() |
|
XP is just a number | |
PerlMonks |
better way to do N to 1 string mappingby tanyeun (Sexton) |
on Nov 14, 2011 at 06:53 UTC ( #937875=perlquestion: print w/replies, xml ) | Need Help?? |
tanyeun has asked for the wisdom of the Perl Monks concerning the following question:
howdy Monks :D I use a hash to implement this mapping
so whenever a given $string %category{$string} will tell you it's category This looks ugly since the category will grow larger and larger and it will duplicates multiple lines with the same category (for example "Grocery" takes 3 lines) is there a better way to do this? something like "restaurant A", "restaurant b" => "Dine Out" "Walmart", "HEB", "Target" => "Grocery" "Movies", "Park", "Shopping" => "Fun" best, David
Back to
Seekers of Perl Wisdom
|
|