http://www.perlmonks.org?node_id=676820


in reply to Re: **HomeWork** Trying to search an array and match it to a user input
in thread **HomeWork** Trying to search an array and match it to a user input

You can also take a look at the module Text::Abbrev. It makes it easy to work with abbreviations of strings.
%hash = abbrev (split(':', "Baltimore:Chicago:Los Angeles:New York:San Diego:"));
chomp (my $input_city = <STDIN> );
if (exists $hash{$input_city}) { ...... }
  • Comment on Re^2: **HomeWork** Trying to search an array and match it to a user input