for my $var (@vars) { my $new_var = lc $var; print "Value: " . $hash_ref->{$new_var} . "\n" if exists $hash_ref->{$new_var}; }