wsee has asked for the wisdom of the Perl Monks concerning the following question:
I have a big Hash list, the some of the keys are made up of the combination of regular expression pattern. For example :
%cat = ( 'C[AEIOU]NWAY' => 'AAA', '(BOSTON|CHICAGO)' => 'BBB', '(LAS VEGAS|NEVADA)' => 'CCC' '(DALLAS|AUSTIN)' => 'DDD' '(NASHVILLE|M[AEIOU]MPHIS)' => 'EEE' );
I would like to search the KEYS and compare to a $variable, and print the VALUE for the matched $variable.
For example, if the $variable = 'CHICAGO', then I would like to pull the corresponding value which is 'BBB'.
Could anyone give me some idea or suggestion?
Thank you...
William
Back to
Seekers of Perl Wisdom