in reply to better way to do N to 1 string mapping

You can turn your mapping on its head, by specifying it like this:

my %store_for_category = ( "Dine Out" => ['restaurant A', 'restaurant B'], "Grocery" => ['Walmart', 'HEB', 'Target'], ... );

You can convert from the category to the store by:

my %category_for_store; for my $category (keys %store_for_category) { for my $store (@{ $store_for_category{ $category }}) { warn "Duplicate category for store '$store': $category_for_sto +re{ $store }, $category" if $category_for_store{ $store }; $category_for_store{ $store } = $category; }; });

Usually, I end up wanting both mappings anyway, from "store" to "category" and to list all stores for a given category. I also tend to want to put a store into more than one category. I end up stuffing the pairs into an SQL database (like DBD::SQLite), but depending on where you keep the rest of the data, that may or may not be suitable for you.