in reply to array to hash
%hash = ( "var1" => "Info on var1", "var2" =>, etc....);
Without knowing any more about your problem than what you've stated, here's what I would do:
my @array = ("var1", "var2", "var3"); my %hash; foreach my $item (@array) { $hash{$item} = "Info on $item"; # or <STDIN> for user input }
Edit:
Your use of the word key is somewhat confusing. Either you want to use the user input as key in a "many to one" mapping to the items in @array (which hotshot's answer will get you) or you want a "one to one" mapping where the keys are the items in @array and each one maps to some user input (which my answer attempts to do). Only you know what it is you need, so use that! :)
~CubicSpline
"No one tosses a Dwarf!"
|
|---|