Hi,

 

I have a hash that will have some keys contain single values and other keys
that will have multiple values:

 

%hash = (

                        key1 => 'test-1',

                        key2 => ['test-2-0', 'test-2-1'],

                        key3 => 'test-3'

);

 

I want to loop through the hash getting the value(s) from each key. When I
try this with the code below, key2 returned something different. 

 

foreach $key(keys %hash) {

            print "$key = $hash{$key}\n";

}

 

screen output:

key1 = test-1

key2 = ARRAY(0x1bdf0b4)

key3 = test-3

 

How could I expand the foreach to also get the values from key2?

 

Regards,

 

Dave

  

Reply via email to