rename variable used in the test

We're going to add another bare-named variable
Fix bug getting value of bare hash variables

When retrieving %hash, it was returning a list of values (key => value).
This owuld cause a crash if you tried to get the value of a more complicated
expression like $hash{key}, because it would try a hash dereference on the
listref value.
move the inner if/else into the outer scope as elsif/else