Only try 2 returns the desired result "OK" from hash1. Why not try 1 and try 3? Am I missing something?#!/usr/local/bin/perl -w use strict; use constant TESTVALUE => 1; my %hash1 = (TESTVALUE => "OK"); my %hash2 = (123 => TESTVALUE); my $hashValue; # Try 1 $hashValue = %hash1->{1}; # Try 2 $hashValue = %hash1->{TESTVALUE}; # Try 3 $hashValue = %hash1->{%hash2->{123}};
In reply to Hash values and constants by Marcello
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |