in reply to Variable Selection

The absolute simplest fix to your code would be to initialise the hash correctly; round brackets not curly:

my %hash =("var1", "info1", "var2", "info2", "var3", "info3");
, and you've broken the equality test in your unless clause: ==, not =.

The perlish rewrite of your code would be:

if (grep {$_ eq $where} @array) { push @result_array, $hash{$where}; } else { push @result_array, $where; }

Update: Of course, if the array is simply the keys of the hash, it gets even easier:

push @result_array, $hash{$where} || $where;

--
Tommy
Too stupid to live.
Too stubborn to die.