my %vlan = ( "VLAN1" => \$vl1 ); # ... while (($key, $value) = each %vlan) { # note the dereferencing ${$var} # can be shortened to $$value print "Now checking: ${system}_$key ${$value}"; }